Required Field
16 posts
• Page 1 of 1
Required Field
How can I require a selection from a drop down menu, but not the first selection which would be "Select a Subject"? I need this for the subject of the form being processed.
- Detlev
- Posts: 21
- Joined: 07/20/2005 @ 03:11
Just make sure the value for the top/default selection is empty, and that should keep any info from being passed to the form triggering an error if no choice is made.
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
Can you post a link to your test page? If it's not being caught as empty, then it must be passing something or another. But I'll need to see your form page to be much help.
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
The only fields I see listed in your "required" field are name and email, niether of the selection menus are there.
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
Nate Baldwin wrote:The only fields I see listed in your "required" field are name and email, niether of the selection menus are there.
Right. What should happen, and works in the recipient field, is that the first label "Select a Recipient" and "Select a Subject" have no value and if chosen will create an error (as you mentioned above). This is not working in the subject field. I presently receive an email with a blank subject field. Are you saying placing subject and recipient in the hidden form field will trigger it? Then why does the recipient field work as described presently?
- Detlev
- Posts: 21
- Joined: 07/20/2005 @ 03:11
If you want a field to be required, you have to tell the script that. In your hidden field named "required", you only have name and email. You'll need to add subject if you want it to be required also.
The recipient field doesn't have to be specified as required, because its required by default in the script. If there's not recipient address, the script can't send out an email. The subject field is not required by default. If no subject is specified, it will just use a default subject line. To make that field required, you need to add it to your required field list (in the hidden "required" field).
The recipient field doesn't have to be specified as required, because its required by default in the script. If there's not recipient address, the script can't send out an email. The subject field is not required by default. If no subject is specified, it will just use a default subject line. To make that field required, you need to add it to your required field list (in the hidden "required" field).
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
Are you using Safari to test? That might explain it - there was (and apparently still is) an odd behavior in Safari to where, if no value is specified, it passes the label information as the value. You can get around it though by specifying a blank value instead of just no value. So, use this:
...instead of this...
Does that fix it for you, or are we talking about different problems?
- Code: Select all
<option selected value="">Select a Subject</option>
...instead of this...
- Code: Select all
<option selected>Select a Subject</option>
Does that fix it for you, or are we talking about different problems?
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
I was having a similar problem where the popup menu was registering as required but it wouldn't let me select an option. I could click on an option but the form or the script wouldn't treat it as selected.
Not knowing the source of the error, I have since gone around the problem by using radio buttons instead - which work better for the form. I used GoLive CS2 to create the form.
Not knowing the source of the error, I have since gone around the problem by using radio buttons instead - which work better for the form. I used GoLive CS2 to create the form.
- ebrad
- Posts: 12
- Joined: 09/22/2005 @ 14:02
ebrad wrote:I was having a similar problem where the popup menu was registering as required but it wouldn't let me select an option. I could click on an option but the form or the script wouldn't treat it as selected.
If that comes up again, post back with a link to the page. I'm sure it's something that can be fixed and still use selection menus, just need to see how you have it set up to know what's going on.
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
I was setting up a test page just so you could see what I was encountering, but now I am having a different problem. Now the form doesn't recognize the pop-up menu as a required field. The popup's name is Type.
http://www.accuscribe.info/operations/test.html
http://www.accuscribe.info/operations/test.html
- ebrad
- Posts: 12
- Joined: 09/22/2005 @ 14:02
Are you testing in Safari? If so, here's a re-paste of a response from a few posts up in the list of this topic. Should fix the problem.
--------------------------------
there was (and apparently still is) an odd behavior in Safari to where, if no value is specified, it passes the label information as the value. You can get around it though by specifying a blank value instead of just no value. So, use this:
...instead of this...
Does that fix it for you, or are we talking about different problems?
--------------------------------
there was (and apparently still is) an odd behavior in Safari to where, if no value is specified, it passes the label information as the value. You can get around it though by specifying a blank value instead of just no value. So, use this:
- Code: Select all
<option selected value="">Select a Subject</option>
...instead of this...
- Code: Select all
<option selected>Select a Subject</option>
Does that fix it for you, or are we talking about different problems?
- Nate Baldwin
- Site Admin
- Posts: 3724
- Joined: 04/25/2003 @ 19:05
I am using Internet Explorer and that fixed it, thank you. If I was smart I would have tried that sooner. Perhaps it's a bug in GoLive that if a value isn't entered, it removes that little bit of code (value="") completely.
thanks,
<select name="Type" size="1">
<option value="">select one</option>
<option value="two">a</option>
<option value="three">b</option>
</select>
thanks,
<select name="Type" size="1">
<option value="">select one</option>
<option value="two">a</option>
<option value="three">b</option>
</select>
- ebrad
- Posts: 12
- Joined: 09/22/2005 @ 14:02
16 posts
• Page 1 of 1
Return to Form Processing (NateMail, ProcessForm)
Who is online
Users browsing this forum: No registered users and 0 guests