• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Ranch Hand
Posts: 501
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 501
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic