noahwilson Posted May 7, 2013 Share Posted May 7, 2013 Hello Guys,how inactive submit button till user not fill the form? how can i make it possible, please share your suggestion and feedback.Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 7, 2013 Share Posted May 7, 2013 You can do it with JavaScript - but that is no real guarantee that the user cannot submit the form until then. So, you definitely want server-side code to reject the submission if all the data is not there. You can, however, add JavaScript to add some client-side functionality to prevent 99% of submissions where the data isn't entered. But, you need to make a decision as to what you will do for users that don't have JS enabled. Do you not allow them to use the form at all or do you let them submit even though they may not have had the form completed. That will be key to how the solution is implemented. Quote Link to comment Share on other sites More sharing options...
buzzycoder Posted May 8, 2013 Share Posted May 8, 2013 I am Agree with Psycho,nowadays javascript is used on large basis & on each & every sites.Below you can find a small code : <html> <head> <title>Disable Form Example</title> <script type='text/javascript' src='http://code.jquery.com/jquery-latest.js'></script> <script type='text/javascript'> $(window).load(function(){ (function() { $('form > input').keyup(function() { var empty = false; $('form > input').each(function() { if ($(this).val() == '') { empty = true; } }); if (empty) { $('#exinput').attr('disabled', 'disabled'); } else { $('#exinput').removeAttr('disabled'); } }); })() }); </script> </head> <body> <form> Name<br /> <input type="text"/><br /> <input type="submit" id="exinput" value="Submit" disabled="disabled" /> </form> </body> </html> Hope it helps you! 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.