Hi there,

I'm using Really Easy Field Validation, which works fine for
validating,
but after succesful validation i want to process the form with Ajax.
Therefore i want to use the 'onSubmit:false' parameter, but if the
validator
doesn't encounter any errors, it still just submits.

I have the newest Prototype, Scriptaculous and Really Easy Field
Validation.

My code is below the message.

Many thanks,
Knal

<form id="myForm" action="contact.php" method="post">
        <input name="name" id="name" class="name" />
        <input name="email" id="email" class="email" />
        <textarea name="message" id="message" cols="40" rows="4"
class="message"></textarea>
        <input type="submit" value="Submit" />
</form>
<script language="javascript">
var valid = new Validation('myForm', { onSubmit:false, immediate :
false, onFormValidate : HandleForm });

Validation.addAllThese([
        ['name', 'Custom name msg', { minLength : 2, maxLength : 75,
include : ['required validate-alphanum'] }],
        ['email', 'Custom email msg', { minLength : 1, include : ['validate-
email'] }],
]);

function HandleForm( result, form ){
        if ( result ) {
                alert('success');
        }else{
                alert('fail!');
                var valid = new Validation('myForm', { onSubmit:false, 
immediate :
true, onFormValidate : HandleForm });
        }
}
</script>

The reason why i'm re-declaring 'var valid' is that after first errors
i wan't the validator
to react on onBlur events instead of waiting for a new submit.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to