Is it possible to pass the id of an input rather than the name to a form?
<fieldset class="det">
<legend>Source of Repair</legend>
<c:forEach items="${sors}" var="sor">
<input type="checkbox" id="sors" name="filterCriteria(SOURCE_OF_REPAIR).values" value="'${sor}'" <c:if test="${form.sorNameMap[sor]}">checked="checked"</c:if>>${sor}</input><br/>
</c:forEach>
</fieldset>
I cant use the name because I’m doing something else with that. I need to pull id="sors"
My form bean only pulls names. Can I pull the id somehow?
If you are talking about handling the submission of the form, then no you cannot. This is not a java limitation, but an HTTP one – HTTP form submission is done by name=value, and ids cannot be used.
If you are using the name for something other than handling the form submission, then you’re probably doing it backwards – the name is for the submission handler, the id (or another attribute) can be used for whatever else you want to do when initialising the form.
One option you could try (but I don’t recommend it) is having some JavaScript then runs through the form fields and changes the names just before submission, but it would be pretty messy.