1

So apparently pos absolute has provided a method for you to display custom error messages with his jquery validation engine script but I can't get it to work. According to his documentation at http://posabsolute.github.com/jQuery-Validation-Engine/#options/custom_error_messages he provides an example for how to implement. For simplicity, I have implemented it as follows..

$('#myform').validationEngine('attach', {'custom_error_messages' : {'#menubuttontext' : { 'required': { 'message': "This is a custom message." }}}} );

For the following form field...

<form action="" name="myform" id="myform" method="post" > <input type="text" name="menubuttontext" id="menubuttontext" class="validate[required]" data-tooltip-options="{&quot;position&quot;:&quot;right&quot;}" value="" size="10" > <input type="submit" name="submit" value="submit" < / form >

When submitting the above form I get the default message "This is a required field" instead of the custom message "This is a custom message" that I'm attempting to implement. Has anyone been able to get this to work? What am I doing wrong?

Thanks in advance!

sybercoda
  • 495
  • 3
  • 6
  • 24

1 Answers1

2

Try this..

<script>
        $(document).ready(function(){
            // binds form submission and fields to the validation engine
                $("#myform").validationEngine({
                'custom_error_messages': {
                    // Custom Error Messages for Validation Types
                    'required': {
                        'message': "your own custom message"
                    }
                }
                ,validationEventTrigger: 'submit'
            });
        }); 
    </script>

The "validationEventTrigger" option will make sure that the message prompt will show up only after the form is submitted and not during onblur events of the respective input field(s).

Even i was also having the same problem with the Validation engine example. A very good way to understand how validation engine works is by going through the demo files in the posabsolute ValidationEngine library package.