Index

Add Client-Side Validation

  1. Add an onsubmit handler to userForm.jsp. This file is located in web/pages. Look for the "<LAB>" indicator in the file to see where you should add this.
    onsubmit="return validateUserFormEx(this)"

    Note: The form is named "UserFormEx" because I have a subclass of UserForm with this name. It has an indexed getter and setter for setting roles. In the regular appfuse project, the UserForm object is generated from a POJO.

  2. Add the JavaScript necessary for enabling the Validator on the client. The placeholder for this code is at the bottom of userForm.jsp.
    <html:javascript formName="userFormEx" cdata="false"
        dynamicJavascript="true" staticJavascript="false"/>
    <script 
        src="<html:rewrite page="/scripts/validator.jsp"/>"
        type="text/javascript"></script>
    
Slide No: 5