Something like:

<textarea name="comments" cols="50" rows="12"></textarea>

Then in the submit button (note it's actually a type="button" not "submit"
as that is done in the JS):

<input type="button" value="Submit Form" onClick="checkForm(this.form);" />

Then in the JS:

<script language="Javascript">
function checkForm(myform) {
        if(myform.comments.value.match(/^\s*$/)) {
                // it's empty
                alert('You must enter a value for comments');
        }
        else {
                myform.submit();
        }
}
</script>

NOT tested for cross-browser compatibility (but from what I recall, there
isn't anything in there that isn't pretty generic anyway).

HTH

Paul

> I have a form - using cfform - with a multiline text box 
> (<textarea name="comments" cols="50" rows="12"></textarea>)
>  
> I want to use JS validation or cfform validation to make sure 
> this box has an entry before the form gets submitted and 
> alert the user if it is empty
>  
> however, I can't find the appropriate CFForm tag to do this - 
> I have found <cftextinput> and <cfinput type="text"> but none 
> of these seems to cater for multi-row boxes??? is there a tag 
> for this?
> 
> _______________________________________________________<?xml:namespace
> prefix = o ns = "urn:schemas-microsoft-com:office:office" />
> 
> *  Regards, 
>                 Richard Lovelock 
> 
> Westminster City Council - Web Support
> Cap Gemini Ernst & Young
> Southbank
> 95 Wandsworth Road
> London 
> SW8 2HG 
> 
> (     0870 906 7482
>  
> _______________________________________________________
> 
>  
> 
> 
> =======================================================
> This message contains information that may be privileged or 
> confidential and is the property of the Cap Gemini Ernst & 
> Young Group. It is intended only for the person to whom it is 
> addressed. If you are not the intended recipient, you are not 
> authorised to read, print, retain, copy, disseminate, 
> distribute, or use this message or any part thereof. If you 
> receive this message in error, please notify the sender 
> immediately and delete all copies of this message. 
> =======================================================
> 
> 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to