From: Andrew Koptyaev on
Hi

I need to test input data from form by php (some mysql) after submit
form. I use onclick event of submit button and run in onclick function
sync jquery ajax get to server php. I know if I want come back to form
I should return false. But I cant return false from success ajax function.

Is exist solution to come back to form not submit.

Thank you!

Andrew.
From: Sean Kinsey on
On Apr 10, 7:24 pm, "Andrew Koptyaev" <haze...(a)gmail.com> wrote:
> Hi
>
> I need to test input data from form by php (some mysql) after submit
> form. I use onclick event of submit button and run in onclick function
> sync jquery ajax get to server php. I know if I want come back to form
> I should return false. But I cant return false from success ajax function..
>
> Is exist solution to come back to form not submit.
>
> Thank you!
>
> Andrew.

In stead of running the xhr in the onclick event, run a regular
asynchronous call instead and return false to stop the submit.
Then when the xhr finishes you either submit the form using js or show
some feedback about what was wrong.
From: Hans-Georg Michna on
On Sat, 10 Apr 2010 21:24:59 +0400, Andrew Koptyaev wrote:

>I need to test input data from form by php (some mysql) after submit
>form. I use onclick event of submit button and run in onclick function
>sync jquery ajax get to server php. I know if I want come back to form
>I should return false. But I cant return false from success ajax function.
>
>Is exist solution to come back to form not submit.

Do you not want to submit the form at all? In that case you
don't even need a form, much less a submit button. Just use
onclick.

Hans-Georg
From: Sean Kinsey on
On Apr 10, 10:06 pm, "Andrew Koptyaev" <haze...(a)gmail.com> wrote:
> > In stead of running the xhr in the onclick event, run a regular
> > asynchronous call instead and return false to stop the submit.
> > Then when the xhr finishes you either submit the form using js or show
> > some feedback about what was wrong.
>
> Thank you.
> But in my config if do on submit onclick="return false;" then submit button
> not working as expected.
>
> If I do like onclick="checkForm();"
> where:
> function checkForm(){
> return false;}
>
> then my form submit as not expected.
>
> weird.

Not weird at all.

its either
onclick="return false;"
or
onclick="return checkForm();"
where checkform = function(){return false;}

From: Andrew Koptyaev on

> its either
> onclick="return false;"
> or
> onclick="return checkForm();"
> where checkform = function(){return false;}
>
That is true.
But question regarding submit from JavaScript.

If I do document.myForm.submit() then I got php script in my URL
and no anything on screen . This php script is form "myForm" action.

If I try to document.getElementById("myInput").submit() where
myInput is input with submit button
then got document.getElementById("myImput").submit is not a function

what is the solution?