0

My portlet-model-hints.xml below stipulates that quantity is required, that works fine.
Now I also want to stipulate that quantity must be made of digits:

<model-hints>
    <model name="com.example.model.MyEntity">
        [...]
        <field name="order" type="long">
            <validator name="required" />
            <validator name="digits" />       <----- Does not work
        </field>
        [...]
    </model>
</model-hints>

PROBLEM: Adding <validator name="digits" /> makes the text field disappear.

Is there a problem in my syntax? Should I do the validation in the JSP instead? By the way here is the JSP form to add/edit my entity:

<aui:form action="<%= editMyEntityURL %>" method="POST" name="fm">
    <aui:fieldset>
        [...]
        <aui:input name="quantity" />
        [...]
    </aui:fieldset>
    [....]
</aui:form>
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373

1 Answers1

0

[Workaround, I am still looking for a better solution]

Not elegant at all, but moving digits validation to the JSP works:

<aui:form action="<%= editMyEntityURL %>" method="POST" name="fm">
    <aui:fieldset>
        [...]
        <aui:input name="quantity">
            <aui:validator name="digits"/>
        </aui:input>
        [...]
    </aui:fieldset>
    [....]
</aui:form>

It must be done in all JSP forms that use the entity.

Community
  • 1
  • 1
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373