I construct a <tr>
line using AngularJS and JSTL, and within that line I have a select
element in which it is run using <c:forEach>
on an enumerator to fill it when the user clicks to insert a new line
<td><select name='atributos[{{$index}}].atributo' class='text large form-control' ng-model='atributo.tipo' ><option value='' selected><spring:message code='------------'/></option><c:forEach var='tipoAtributo' items='${EnumTipoAtributo}' varStatus='loop'><option value='${tipoAtributo.id}'><spring:message code='${tipoAtributo.label}'/></option></c:forEach></select></td>
But select looks like this:
Noticethefirstoption
,thatis,theelement<optionvalue="? object:null ?"></option>
.
When I click to send the form, as it has a validation with a Hibernate annotation it pops the following error, instead of appearing a message of type The Field is obligatory:
Failed to convert property value of type java.lang.String to required type com.project.enums.EnumTipoAtributo for property attributes [0] .type; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @ javax.persistence.Column @ javax.validation.constraints.NotNull @ javax.persistence.Enumerated com.project.enums .EnumTipoAtributo for value? object: null?; nested exception is java.lang.IllegalArgumentException: No enum constant with.project.enums.EnumType attribute. object: null?
When returning to the page this element is deleted and if left blank the validation message usually appears to the user in a way that can understand it, but how can I remove this element with value object:null
? >