Validate form field to make sure it is not empty

zesteathe

New Member
Everyone i am newbie to ASP, I wrote a code that should take the input from HTML form.I have given one textbox that text box value is mandatory. If user doesn't give input to the field. the asp page should show the message that "The field cannot be left empty!" I have written a code, but I am not getting the output. Can anyone help me?My code snippet is index.html\[code\] <form method="post" action="a1.asp"> Field 1<input type="text" name="field1">* </br></br><input type="submit" name="send" value="http://stackoverflow.com/questions/11790989/submit"> <input type="reset" name="clear" value="http://stackoverflow.com/questions/11790989/clear"> </form>\[/code\]a1.asp\[code\] <%Function Mandatory(field1)if field1 = "" thenresponse.write("Field one is mandatory!cannot be left empty")elseresponse.write("Welcome to new html")End ifEnd Function%>\[/code\]
 
Back
Top