• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How do I pass the value of JavaScript variable to a Thymeleaf variable

 
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to set the value of an HTM input tag to a Thymeleaf variable. In the HTMl I have

I set the value using JavaScript, selecting it from a row in a table:

The value is set with

and that is working correctly.
I want to pass the velue as a parameter to a method in a controller

The code in the controller is



Since the value is in an input tag I tried to pass the value using a form

I did changed the method to "@PostMapping("/ModifyUser")". But the HTMl gets disarranged. At this point my only hope is to find a way to pass the value of JavaScript variable to a Thymeleaf variable.
 
Alejandro Barrero
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved the problem with 'style="display: inline-block;"', but I still would like to know how to pass the value of JavaScript variable to a Thymeleaf variable.
 
What a show! What atmosphere! What fun! What a tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic