Thank you.
But when I do that, then the submit does does not work at all.
What I wanted to do is to display the errors in same page, and if no errors,
continue normally to next page
this is what I got in my php
if(is_array($errors))
{
while (list($key,$value) = each($errors))
{
echo "<strong>" . $error . "</strong></ol>";
}
exit;
}
----- Original Message -----
From: "Mike Alsup" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, January 11, 2008 1:31 PM
Subject: [jQuery] Re: Please help me correct this
>
>> I am new to jquery. After a lot of trial and errors, I managed to
>> accomplish what I wanted: beforesubmitting to a form, I check for php
>> errors and then I display them in a div above the submit button. Works
>> great. But the problem that I am having, if there are no errors, the
>> form submits as wanted BUT the next page displays in the div!!!!!
>>
>> Can someone kindly complete that one line that is missing in below
>> code? Thank you.
>>
>>
>> $(document).ready(function() {
>> var options = {
>> target: \'#myerror\',
>> beforeSubmit: showRequest,
>> success: showResponse
>>
>> };
>>
>> $(\'#myformOne\').ajaxForm(options);
>> });
>>
>> function showRequest(formData, jqForm, options) {
>> var queryString = $.param(formData);
>> }
>> function showResponse(responseText, statusText){}
>>
>
> The next page is displayed because you're using the target option.
> Presumably the server response for the form submit is the next page.
> The form plugin takes that and puts it into the target element(s).
> That's what the target option is for. If you're doing some validation
> in the beforeSubmit callback then you could set target to null if the
> validation succeeds.
>
> Mike
>