An entity with this field (or any length of 30 or less):
Will have this text field in its create/update view:Code:@NotNull @Size(max = 30) private String name;
Whereas if the field's max is over 30, you get a text area instead:Code:<form:input cssStyle="width:250px" id="_name_id" maxlength="30" path="name" size="0"/> <br/> <form:errors cssClass="errors" id="_name_error_id" path="name"/> <spring:message arguments="Name" code="field.invalid" var="field_invalid"/> <spring:message code="field.required" var="field_required"/> <spring:message argumentSeparator="," arguments="Name,(${field_required})" code="field.simple.validation" var="field_validation"/> <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_name_id', widgetType : 'dijit.form.ValidationTextBox', widgetAttrs : {promptMessage: '${field_validation}', invalidMessage: '${field_invalid}', required : true}})); </script>
The difference to the user is that in the second case, there's no client-side validation, i.e. the field doesn't get the nice decorators when it loses focus and is still empty.Code:<form:textarea cssStyle="width:250px" id="_name_id" path="name"/> <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_name_id', widgetType: 'dijit.form.SimpleTextarea', widgetAttrs: {}})); </script> <br/> <form:errors cssClass="errors" id="_name_error_id" path="name"/>
Can anything be done about this lack of validation, preferably by enhancing Roo or even via a manual change to the view?


Reply With Quote
