Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
TWO mistakes I am noticing in your example with select is that you fail to include a submit button. If you do not include a submit button in the form, then the select itself will never submit itself. The visitor has no way to submit the form.

You could link the submit action to the onChange event with JavaScript as poj showed you, but that means that even if the user selects the wrong item by accident, your program will submit the selected value. Lol A better way is to include a submit button as huck showed you in his example. So, the user should pick an item from the list and then should press "Submit" to submit the values to the perl script.

The second mistake is that the <SELECT> tag should not have VALUE="" defined in it! If you want a default item selected already when the user loads the page, you can achieve that by doing this. CORRECT WAY:

<select name="cars">
<option value="volvo">Volvo
<option value="saab" SELECTED>Saab
<option value="fiat">Fiat
<option value="audi">Audi
</select>

(Shh!! I'm just whispering to your ear: The closing tag for </OPTION> is also totally unnecessary.)


In reply to Re: return values on select after submit by harangzsolt33
in thread return values on select after submit by bigup401

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found