I've got a html form which is using Thymeleaf and SpringBoot. In my form, I have two options, either hardware or software. I've figured out how to hide each section depending on which radio button is selected but am having trouble in actually using the data on one or the other. Here's what I mean:
Top of form:
Radio input:
Hardware,
Software
if(Hardware selected)
Show "Hardware Question Section"
Hide "Software Question Section"
Form th:action should be hardware form object
Spring controller for form should disregard software object and NOT throw any errors
Form should submit to hardware url (mm/add-new-entry/hardware)
If error with form, redirect back and notify user.
if(Software selected)
Show "Hardware Question Section"
Hide "Software Question Section"
Form th:action should be hardware form object
Spring controller for form should disregard software object and NOT throw any errors
Form should submit to hardware url (mm/add-new-entry/hardware)
If error with form, redirect back and notify user.
Would this be possible with Thymeleaf and JavaScript? I know I would need to put logic into Java in order to ensure that if one is selected the other shouldn't error out.
Yes, It is possible with JS & Thymeleaf. Put the hardware & software section in 2 different div or section with different ID. Show/Hide Hardware/software div according to the radio input. Also put logic into Java in order to ensure that if one is selected the other shouldn't error out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.