Forum Moderators: open

Message Too Old, No Replies

Help with HTML Form Data

HTML Form Data Defaults

         

Becky_W

5:44 pm on Aug 31, 2006 (gmt 0)

10+ Year Member



I have a problem with my html form where the drop down option chosen does not get sent to me (unless the user clicks on it to highlight it) - rather the default option (selected="selected") always gets sent back by email. So each table reservation is sent back as 01 January 2006. Any suggestions as to how to correct this would be really appreciated (I am very new to coding).

rocknbil

7:11 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard Becky!

Post the code from the select list here. You've probably just got something wrong in the list itself.

A form processor processes the form objects by name and displays their selected value. So in a select list,

<select name="widgets" id="widgets">
<option value="">SELECT</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>

By default, the first item in the list will display unless you have tagged one of the options as selected:

<option value="some_value" selected>Some Value</option>

It's my guess something in the first value is messed up and putting selected into the value, like maybe

<option value=selected>SELECT</option>

Post your code and someone here will fix it for you. :-)

Becky_W

4:30 pm on Sep 4, 2006 (gmt 0)

10+ Year Member



Thanks for the speedy reply and warm welcome to the site. I have put in the value part of the tag as below, but this has the effect of missing out the data altogether when the form data comes through to me on email.

Here is the original code used:

<select id="month" size="1" multiple="multiple" name="month">
<option selected="selected">January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>

And here is the amended code that is missed out altogether in the email response.

<select id="month" size="1" multiple="multiple" name="month">
<option value="">Select</option>
<option value="january">January</option>
<option value="february">February</option>
<option value="march">March</option>
<option value="april">April</option>
<option value="may">May</option>
<option value="june">June</option>
<option value="july">July</option>
<option value="august">August</option>
<option value="september">September</option>
<option value="october">October</option>
<option value="november">November</option>
<option value="december">December</option>
</select>

Would really appreciate any advice anyone could give me on this one!

Becky

Rightz

5:22 pm on Sep 4, 2006 (gmt 0)

10+ Year Member



Try:

<select id="month" size="1" multiple="multiple" name="month">
<option value="january" selected>January</option>
<option value="february">February</option>
<option value="march">March</option>
<option value="april">April</option>
<option value="may">May</option>
<option value="june">June</option>
<option value="july">July</option>
<option value="august">August</option>
<option value="september">September</option>
<option value="october">October</option>
<option value="november">November</option>
<option value="december">December</option>
</select>

This works if you want to default to January

[edited by: Rightz at 5:33 pm (utc) on Sep. 4, 2006]

Rightz

5:42 pm on Sep 4, 2006 (gmt 0)

10+ Year Member



In adition you may want to check out this page for info on using javascript for it to default to todays date:

[javascript.about.com...]

[edited by: encyclo at 6:21 pm (utc) on Sep. 4, 2006]
[edit reason] linked URL [/edit]

tbear

5:47 pm on Sep 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you use these......

<input type="hidden" name="subject" value="Form submission">
<input type="hidden" name="required" value="name,email,info">
<input type="hidden" name="sort" value="order:name,email,info">

?

Welcome ..........:)

rocknbil

8:10 pm on Sep 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So each table reservation is sent back as 01 January 2006.

Based on this statement, I have to ask, why are you using select multiple? While someone may want to make multiple reservations, connecting specifics of various reservations (how many people, booth or table, event title such as birthday, etc.) may be more confusing than anything.

The simplest solution (IMO) if you want to allow multiple reservations on a page is to have several sections and label them reservation #1, 2, 3. Dispense with selected values altogether. Just put a blank value in the first option and it will be selected by default.

The truth is, a lot of people don't even know how to use select multiple and it opens the option for user error. If you don't MAKE them do it right, they are likely to miss it. By setting january as selected, they may just not be selecting the month.

By using a regular drop-down

<select name="res_1_month" id="res_1_month">
<option value="">select</option>

You can check using Javascript or your server-side language for a blank value. If it's blank, return an error "Select your reservation month."

but this has the effect of missing out the data altogether when the form data comes through to me on email.

That's because nothing is "selected" now. Did you select one of the options? Again, select-multiple is confusing to many. :-)

Try the non-multiple method, I think that's what you're lookng for.

Becky_W

8:46 pm on Sep 5, 2006 (gmt 0)

10+ Year Member



To you all a HUGE thank you. I am one very happy lady. My form is all working nicely. I used the suggestion to take out the 'multiple' part of the tag. Why I didn't think to do that before I don't know!

So, thank you very much once again.

Becky :)