Required Field

NateMail, ProcessForm, JavaScript Form Validator, Form Security, etc.

Required Field

Postby Detlev » 08/14/2005 @ 20:48

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

Postby Nate Baldwin » 08/15/2005 @ 11:25

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

Postby Detlev » 08/16/2005 @ 06:45

Nate Baldwin wrote: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.


Tried that. It did send the message.
Detlev
 
Posts: 21
Joined: 07/20/2005 @ 03:11

Postby Nate Baldwin » 08/16/2005 @ 10:31

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

Postby Detlev » 08/16/2005 @ 21:31

Detlev
 
Posts: 21
Joined: 07/20/2005 @ 03:11

Postby Nate Baldwin » 08/17/2005 @ 10:33

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

Postby Detlev » 08/18/2005 @ 20:14

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

Postby Nate Baldwin » 08/19/2005 @ 11:06

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).
Nate Baldwin
Site Admin
 
Posts: 3724
Joined: 04/25/2003 @ 19:05

Postby Detlev » 08/22/2005 @ 06:35

I added subject to the required field yet it still sends the message. The value on the form is blank but there is a label— "Select a Subject". The label is being sent as the value for some reason.
Detlev
 
Posts: 21
Joined: 07/20/2005 @ 03:11

Postby Nate Baldwin » 08/23/2005 @ 09:51

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:
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

Postby Detlev » 08/23/2005 @ 12:16

Bingo! Thanks Nate.
Detlev
 
Posts: 21
Joined: 07/20/2005 @ 03:11

Postby ebrad » 09/28/2005 @ 09:29

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.
ebrad
 
Posts: 12
Joined: 09/22/2005 @ 14:02

Postby Nate Baldwin » 09/28/2005 @ 10:43

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

Postby ebrad » 09/28/2005 @ 15:51

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
ebrad
 
Posts: 12
Joined: 09/22/2005 @ 14:02

Postby Nate Baldwin » 09/28/2005 @ 16:15

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:
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

Postby ebrad » 09/29/2005 @ 08:28

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>
ebrad
 
Posts: 12
Joined: 09/22/2005 @ 14:02


Return to Form Processing (NateMail, ProcessForm)



Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron