Hello
I am a web beginner, and I am trying to write a site which involves an opening login page. There is a form as follows:
<form name="frontform" method=POST action="<label>Username </label><input name="Userniame"><br><br><br>
<label>Password </label><input name="Passwiord"><br><br><br>
</fieldset><br>
<button name="pjtbtn" type=submit>Submit</button>
</form>
I am trying to get the user to fill in the correct details that will then get POSTed to the next page. I have done validation as follows:
<script language=vbscript>
sub pjtbtn_onclick
if len(trim(document.frontform.Userniame.value))=0 then
msgbox "Please enter username"
end if
if len(trim(document.frontform.Passwiord.value))=0 then
msgbox "Please enter password"
end if
end sub
</script>
What I need now is a method of cancelling the POST if the user does not fill in the details, and returning him to the form so he can try again. I presume this will take place in the script section: am I correct?
I have chosen to use VBscript not Javascript as all this takes place on an intranet where we know we will be using only IE.
I would be grateful for code snippets showing me a method of cancelling the POST unless the input is validated correctly.
Many thanks,
Trimtrom
I am a web beginner, and I am trying to write a site which involves an opening login page. There is a form as follows:
<form name="frontform" method=POST action="<label>Username </label><input name="Userniame"><br><br><br>
<label>Password </label><input name="Passwiord"><br><br><br>
</fieldset><br>
<button name="pjtbtn" type=submit>Submit</button>
</form>
I am trying to get the user to fill in the correct details that will then get POSTed to the next page. I have done validation as follows:
<script language=vbscript>
sub pjtbtn_onclick
if len(trim(document.frontform.Userniame.value))=0 then
msgbox "Please enter username"
end if
if len(trim(document.frontform.Passwiord.value))=0 then
msgbox "Please enter password"
end if
end sub
</script>
What I need now is a method of cancelling the POST if the user does not fill in the details, and returning him to the form so he can try again. I presume this will take place in the script section: am I correct?
I have chosen to use VBscript not Javascript as all this takes place on an intranet where we know we will be using only IE.
I would be grateful for code snippets showing me a method of cancelling the POST unless the input is validated correctly.
Many thanks,
Trimtrom