• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 494
  • 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: 494
  • 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.
 
BWA HA HA HA HA HA HA! Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic