LittleNicky Posted August 13, 2006 Share Posted August 13, 2006 Ok this should be an easy one.How do I set a field in a form as required? Link to comment Share on other sites More sharing options...
reportingsjr Posted August 13, 2006 Share Posted August 13, 2006 Here, (btw, please respond to my pm).In the header: <style type="text/javascript" language="javascript">IsEntered(input){var input= document.getElementById(input);if(input == ""){alert("You need to fill in the "+form+" section of the form");}}</style> For the form: <form ...>.....<input type="text" name="blah" id="name" onblur="IsEntered(name)" />.....</form> So when people click outside of this it will check, and alert the person if its empty. You might want to use a function to strip the spaces from it to check it. Not sure what function to use to do that though. Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted August 14, 2006 Share Posted August 14, 2006 you will also want to check if it's empty after the forum is submitted, because they may disable JS. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now