Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > HTML Select problem

Reply
Thread Tools

HTML Select problem

 
 
howachen@gmail.com
Guest
Posts: n/a
 
      09-11-2006
Hi, is it possible to have a pre-defined value for select box which
mean "select nothing"?

e.g.


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

I want to have an option something like <option value="xxx">Please
Select</option>

and when the form get

it will shown in the query string only IF it was selected.

e.g.

test.php?car=Saab

but the default is just:

test.php

 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      09-11-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi, is it possible to have a pre-defined value for select box which
> mean "select nothing"?
>
> e.g.
>
>
> <select name="cars">
> <option value="volvo">Volvo</option>
> <option value="saab">Saab</option>
> <option value="fiat">Fiat</option>
> <option value="audi">Audi</option>
> </select>
>
> I want to have an option something like <option value="xxx">Please
> Select</option>



Well yes and no. You can certainly have a null value or a token that
means "none", then your receiving script would deal with it
appropriately, but the parameter will show in the query string:

<select name="cars">
<option value="none">Please Select</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>

....

test.php?car=none&otherParam=something

or

<select name="cars">
<option value="">Please Select</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
....

test.php?car=&otherParam=something

The only ways to prevent the param from being in your query string is to
use client-side javascript to remove it (or build the query string) But
this would be a bad idea because it will fail if the client has
javascript disabled. *I would not recommend it.*


The other is use POST instead of GET where the query is not in the URL.
Not sure from your brief snippet whether on not your form is selecting a
resource (GET is appropriate) or transmitting data (POST is appropriate).


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select gridview row without using select button? =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 5 02-27-2009 02:56 AM
programmatically select an option in "select" box in html rvelosoo Javascript 1 08-13-2008 10:53 AM
select.select() on windows jas Python 4 10-27-2005 11:10 AM
Selection from One SELECT changes selected option of another SELECT? J. Hall HTML 2 04-21-2004 05:36 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments