html form submits prematurely on validation subroutine using jquery dialog box -


I am using the jquery dialog box to display the message while the form is complete. Eventually, the last dialog box starts working in the last brief, but the "X" does not appear, the box automatically dismisses it, and the form is deposited before the time.

The sample of an incomplete dialogue box is here:

(The form must be submitted before the "X" image is displayed.)

I I am using jquery-1.10.1.

I think this may be a jquery problem when I change the jquery dialog box with a simple "alert", it works.

Here is javascript:

  function Walatta () {Warning ("Watch closely; dialog box pops up, dismiss automatically, and submit form" ) $ ("& Lt; div title = 'Basic dialog onclick' & gt; Create simple b4 submit & lt; / div & gt;). Return  

Here's the html:

  & lt; Form NAME = "mainform" METHOD = "POST" ACTION = "http: //www.bbhq .com / dummy.htm" onSubmit = "return Walatta ()" & gt; & Lt; A href = "#" onclick = "alert ('look, it works here')" & gt; The test dialog box is here & lt; / A & gt; & Lt; P & gt; 1. This question is 1. & Lt; Input type = name of text = ques1 & gt; & Lt; P & gt; 2. This question is 1. & Lt; Input type = name of text = ques2 & gt; & Lt; P & gt; 3. This question is 1. & Lt; Input type = name of text = ques3 & gt; & Lt; P & gt; & Lt; INPUT TYPE = "submit" VALUE = "Click here to submit form" & gt; & Lt; / Form & gt;  

In the onsite code, I have tried it without "return" and without it.

I tried to remove the on-boot, and instead of the input, a function submitted with a button calls the call and then submits the form. The result was this.

My sample is here: (Sorry, I could not do JSfield for me.)

I am a newbie with jquery, but I have dozens of forms, Explaining?

Thank you,

Onsite attribute on the form add it to your page:

  $ (document) .ready (function () {$ ('form [name =' mainform ']'). Submit (function (E) {e.preventDefault (); e.stopImmediatePropagation ( ); Valdata (); return false;})});  

What it does:

1) Wait for the dome to load:

  $ (document) .ready (Function) {{Code>  

2) Form a submit handler for the form:

  $ ('form [name =' mainform ']'). Stop the default browser behavior (ie: after the attribute action on the form  
  e.preventDefault () ;  

4) Prevent the event from bubbling the call stack

  e.stopImmediatePropagation ();  

5) Call your function

  valdata ();  

6) false refund to stop form to prevent form (actual truth to allow form to be submitted)

  return false ;  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -