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; } Link to comment https://forums.phpfreaks.com/topic/177063-solved-restricting-form-submit/ Share on other sites More sharing options...
haku Posted October 9, 2009 Share Posted October 9, 2009 Ok. Link to comment https://forums.phpfreaks.com/topic/177063-solved-restricting-form-submit/#findComment-933596 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;' Link to comment https://forums.phpfreaks.com/topic/177063-solved-restricting-form-submit/#findComment-933598 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()"/> Link to comment https://forums.phpfreaks.com/topic/177063-solved-restricting-form-submit/#findComment-933663 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> Link to comment https://forums.phpfreaks.com/topic/177063-solved-restricting-form-submit/#findComment-933669 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.