PDA

View Full Version : Validate with Alert and Confirm



fmrock
10-01-2007, 02:59 PM
Hey Everyone, I am pretty novice at JS and know you all can help.

I basicly have one text area and a few different submit buttons. Each button means something different. I basicly want to validate the form by.

WHen they click the "Electronic Signature" I need to check the Addendum field to see if its blank or "Please enter your comment." If thats blank, then i need to just alert a message box, which when they click ok.. just takes them back to the form.

But if they acually fill in any info in the addendum field, i would like the js confirm with a msg i create and an OK and Cancel button.




<form action="update.asp" method="post" name="frmAddendum">

<textarea name="Addendum" id="Addendum" cols="55" rows="5" onClick="clearComments(document.frmAddendum.Addendum)">Please Enter your Comment</textarea>
<br>
<input name="btnSubmit" type="submit" id="btnSubmit" value="Electronic Signature">

</form>