sure it can be done
[EMAIL PROTECTED] wrote:
>Hi all,
>
>I was wondering if there is a way to check if a field in a form has been
>left blank and, if it is, not have it appear on the e-mail (that I get
>from the form processor.)
>
>For example, my code is:
>
><td width="5%">
> <input type="checkbox" name="Butternut Squash Soup"
>value="Butternut Squash Soup" size="2" />
> <input name="Butternut Squash Soup quantity" type="text" size="2"
>maxlength="5" />
></td>
><td width="23%">Butternut Squash</td>
>
>I want people to be able to check the checkbox if they want the item and
>then put in the quantity in the "quantity" box. If they don't check the
>box, nothing for that item comes back on the form. When I get the form
>back, it has all the quantity items, even if they didn't enter a
>quantity.
>Am I making any sense?
>
>
do not put spaces in the form element names (name=Butternut_Squash_Soup)
is good.
in the <form ..> tag add something like onSubmit=validate_form() like
<form name=f1 method=post action="your_url" onSubmit=" return
validate_f1(this);">
....
</form>
now somewhere in the <head> part put something like
<script language="javascript">
function validate_f1(f) {
if ( !f.Butternut_Squash_Soup.selected)
f.Butternut_Squash_Soup_Quantity.value='';
}
put other form elements that u want to check in this function.
(NOTE this is untested. check a javascript book to get correct syntax)
HTH
R'twick
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.