CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
this can be done, but how? check drop down menus for input?

 



ijsman
Novice

Jun 7, 2002, 2:42 AM

Post #1 of 5 (1630 views)
this can be done, but how? check drop down menus for input? Can't Post

I'm using formmail right now, this works fine for checking if a user has entered a subject (that's a textfield) but i also need them to make a selection out o a drop down list. But this can't be checked by formmail (at least, i can't figure it out).



Basically, what I'm looking for is a script that can check any kind of form element to see if the user has selected his choice.

anyone know a good script for this? I have searched practically everywhere, but no luck so far!


(This post was edited by ijsman on Jun 7, 2002, 3:03 AM)


Jasmine
Administrator

Jun 8, 2002, 10:27 AM

Post #2 of 5 (1625 views)
Re: [ijsman] this can be done, but how? check drop down menus for input? [In reply to] Can't Post

First, you please use [url=http://nms-cgi.sourceforge.net/]nms formmail instead of MSA's formmail. See [url=http://www.scriptarchive.com/nms.html]Matt Wright's note, which states:

While the free code found at my web site has not evolved much in recent years, the general programming practices and standards of CGI programs have. nms is an attempt by very active programmers in the Perl community to bring the quality of code for these types of programs up to date and eliminate some of the bad programming practices and bugs found in the existing Matt's Script Archive code.

I would highly recommend downloading the nms versions if you wish to learn CGI programming. The code you find at Matt's Script Archive is not representative of how even I would code these days.


To make a field required, simply enter a hidden tag within your form tag, like this:


Code
<input type="hidden" name="required" value="name,comments">


The above example would require that the fields named "name" and "comments" are filled in.


(This post was edited by Jasmine on Jun 8, 2002, 10:28 AM)


ijsman
Novice

Jun 12, 2002, 4:17 AM

Post #3 of 5 (1617 views)
Re: [Jasmine] this can be done, but how? check drop down menus for input? [In reply to] Can't Post

yeah, but that only works for textfields


kidd
User

Jun 12, 2002, 8:13 AM

Post #4 of 5 (1616 views)
Re: [ijsman] this can be done, but how? check drop down menus for input? [In reply to] Can't Post

Lets say you have your drop down menu like this:

<select name="mytransportation">
<option value="0">Select</option>
<option value="car">Car</option>
<option value="bike">Bike</option>
<option value="van">Van</option>
</select>


On your formail cgi you could check that $mytransportation != 0, that means that they selected at least one choice....

Hope this helps...

"So you want to be a cowboy
Well you know it's more than just a ride
Guess you got to know the real thing
If you want to know the other side
Ain't nobody riding shotgun
In this world tonight"


Jasmine
Administrator

Jun 12, 2002, 1:52 PM

Post #5 of 5 (1615 views)
Re: [ijsman] this can be done, but how? check drop down menus for input? [In reply to] Can't Post

It works for any input field. Just add it to your required field.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives