• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Html Select

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

it could be a little problem but i am not able to rectify it.




I have a select drodown. In which Test21 and Test22 are part of Test2. Whenever i select Test21 it shows me selected value with spaces.Is there any way these spaces can be remvoed when user select value and can be appeneded whenever use open the dropdown section.

Please tell me if i am not able to clear my problem

Thanks all!
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post the part where you extract the selected value of the dropdown. I think you might be making some error there, since as I see, the options you've specified for Test21 and Test22 do not contain any spaces. So if you select these values, there shouldn't be any spaces either.

Also, considering the kind of grouping you want to achieve in your dropdown, I think you should take a look at the OPTGROUP tag used in conjunction with the <SELECT> tag.
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anirvan Majumdar:
Could you post the part where you extract the selected value of the dropdown. I think you might be making some error there, since as I see, the options you've specified for Test21 and Test22 do not contain any spaces.



i added " " before it but i think it is removed during the post.
I look at optgroup link .But can not we select the label value. Client want to make us selected label value as well. Is there any other option..
Thanks
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
again the same thing.
Post escapes

i added & n bsp before Test21 and Test22.
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think there's something amiss here.
As I see the code pasted by you in the first post, the <option> for Test21 and Test22 look like:

<option value="Test21"> Test21</option>
<option value="Test22"> Test22</option>

Now, I believe when you select either of the options, it is the corresponding "value" attribute which gets sent back to the server. So say, for Test21 option you had used something like:

<option value="Test21">Blah</option>

Even in this case, when you select "Blah" the value sent back to the server will be Test21.
Now what I don't quite understand is: Do you want to send the "value" [in your case say "Test**" without the spaces] of the option selected or the "text" of the option [in your case say " Test**" with the spaces]?
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


See the problem is not with the value . Problem is with the text

i have text with spaces and whenever i select the text it is shown with spaces in dropdown(text box). what i want when user has selected the value it must be shown without spaces in dropdown(text area) but when user lists the dropdown it must show that value with spaces.

Hope i am able to clear my requirement.

Thanks.
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Woah!

That's one helluva convoluted requirement. Nonetheless, if that's what you've got to do, then maybe you can try doing this: associate a JS method with the "onchange" of your select and pass a reference to the select element. Like: onchange = "changeTxt(this)"
In the "changeTxt" method you can have something like:


I hope this solves your problem
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anirvan,

Thanks a lot!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic