Pipe data in POST-Controller with dynamically created th:name's (Spring Web, Thymeleaf)
So basically I want, that the th:name stated in the screenshot, the value gets piped into the form-class.
Normally you would have i.e. th:name=${someName} and with the POST-request, it gets piped into Form.someName and you can get it with getSomeName().
But in my cae, these th:name's are rendered dynamically with the list-size and each tbody has these two fields. i need to solve it this way, because otherwise, i would only be able to chose on radio button of all and i would only get that value, which is obv nonsene.
10 Replies
⌛
This post has been reserved for your question.
Hey @Suika! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
First of all, you might want to consider using radio button groups I think
to make sure you know which ones belong together/shouldn't be selected together
and what exactly happens with the current approach?
i actually just fixed it seconds ago
solution was to add array Boolean[] b = new Boolean[size]; lol
how do i use radio button groups
i googled it but all i get is tyoe="radio"
Stack Overflow
Multiple radio button groups in one form
Is it possible to have multiple radio button groups in a single form? Usually selecting one button deselects the previous, I just need to have one of a group deselected.
<form>
<field...
it seems like having the same
name
is finemy buttons have the same group
i mean name
but it loks cleaner above
yeah I didn't know how radio button groups work xd
I just knew they existed
hahaha
thanks anyway
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@653351602983272459>.