To continue form submitting you can directly call the submit after the
ajax validation.
a quick example could be:

var form = $('form_id');

form.observe('submit', function(event){
        new Ajax.Request(validition_url, {
                onSuccess : function(response)
                       // if the response is empty submit the form
                       if ( ! response.responseText)
                                return form.submit();
                        // else show errors

May i ask why don't you move the validation into the method that is
the action of the form?
in this case the solution provided by T.J is perfect, the same php
method is invoked both for the ajax validation that the form action
(remember the flag viaAjax).

What if is a user has javascript disabled? or a malicious user
bypasses the validation sending a malformed request directly to the
action of the form?

sorry for my bad english and my divagations about the security :)


On Jun 16, 2:23 pm, Matt <> wrote:
> Is there some kind of trick involved?  Here's how I would envision it
> working:
> 1) User tries submitting the form
> 2) Event.observe captures this and sends an AJAX request to a special
> validation URL (PHP using Codeigniter)
> 3) If no errors were returned, continue submitting the original form
> 4) If errors were found, cancel form submission and display
> Mostly, I can't seem to get a separate AJAX validation request to work
> as the form continues submitting.  I could use Event.stop(event), but
> have not found a way to re-start the process if no validation errors
> exist from the validation call.  I'd post code, but I have about 15
> examples of things I've tried and it would just clutter this question.
> Any ideas?  :-(  I didn't think form validation would be this
> difficult.
> Many thanks,
> - Matt

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to