0

The problem:

when the input type on my submit button is changed to 'button' it does NOT save info to mysql but validation works. If i change it to input type on submit button to 'submit' it saves info to mysql but the validation does not work. Is there a resolution to this?

jquery validation - function on click:

 $("input:button").click(function(){         
               var retVal = false;
               $.each([1, 2], function(i, val){
                  retVal = (validate(val) || retVal);
               });
                return retVal;   

On my form the submit button code is:

<input type="submit" value="Submit" />

The form action is:

   <form name="list1"; action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >

2 Answers 2

2

Write $("input:submit") instead $("input:button") in your jQuery code

Sign up to request clarification or add additional context in comments.

Comments

0

I think the right way to do this is to the leave the button as <input type='submit' /> and use $('form').submit(...) to return true/false based on the validation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.