Monday, May 10, 2010

Grails remote jQuery form validation

<script type="text/javascript">

$(function (){

    $("#form").validate({

        rules: {

            'address.postalCode': {

                required: true

            },

        },

        messages: {

            'address.postalCode': {

                required: "Please enter a postal code."

            }

        }

    });

});

</script>

<g:form method="post" action="register" name="form">

    <input type="text" name="address.postalCode" id="postalCode" />

    <input type="submit" value="Proceed" />

</g:form>

No comments:

Post a Comment