zohab Posted October 9, 2009 Share Posted October 9, 2009 Hi, In my site i want to restrict user from submitting form example if(condition==true){ document.loginfrm.submit=true; }else{ document.loginfrm.submit=false; } Quote Link to comment Share on other sites More sharing options...
haku Posted October 9, 2009 Share Posted October 9, 2009 Ok. Quote Link to comment Share on other sites More sharing options...
jon23d Posted October 9, 2009 Share Posted October 9, 2009 Javascript alone cannot prevent one from submitting the form. Javascript can be ignored or changed, but: frm.onSubmit = 'return false;' Quote Link to comment Share on other sites More sharing options...
zohab Posted October 9, 2009 Author Share Posted October 9, 2009 when i do document.loginfrm.submit(); then form submit what i need to do to restrict form not to be submit after clicking on <input type="submit" name="submit" value="Submit" class="submit" onClick="showCustomer()"/> Quote Link to comment Share on other sites More sharing options...
zohab Posted October 9, 2009 Author Share Posted October 9, 2009 Plz try following example <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script language="javascript"> function validate(x){ if(x=="1"){ alert(x); return false; // document.frmlogin.submit().disabled; } } </script> </head> <body> <form action="" method="post" name="frmlogin"><table width="200" border="1"> <tr> <td> </td> <td><label> <input type="text" name="textfield" /> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="Submit" value="Submit" onclick="validate(1)" /> </label></td> </tr> </table> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.