Hi Yongping,

Yongping wrote:
I added a checkbox in signup.jsp and let it be required (required="true"). I
add a field (named as "yes") in User entity but mark it as transient and
meanwhile define a key like user.yes=xxx in ApplicationResources. Next I add
validation rule into User-validation like <field name="user.yes">
        <field-validator type="required">
            <message key="errors.required"/>
        </field-validator>
    </field>
However 1. there is no required indicator (*) showing up on screen page.
2. this new rule is not invoked when I didn't check it and hit submit
button
I'm not sure that "required" actually makes any sense for a checkbox. Typically an unticked checkbox doesn't actually return anything in a HTTP post anyway. What do you mean when you "require" a checkbox field? That it is always to be checked? If so, then perhaps you should either not put the checkbox on the page, and simply set that value by default in your Action or wherever, or else set it before rendering the page and make it read-only.

HTH,
Rob Hills
Waikiki, Western Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to