• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

textbox to listbox(simple)

 
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i hav a strange requirement.but it'll be easy.it's actually inside my JSP page.but it's only related to HTML or javascript.
i hav 3 textfields for searching.that is ,
1)products textfield(user can enter product name then click search)
2)company textfield(user can enter company name then click search)
3)category textfield(user can enter company name then click search)
put value in any textfield and click search.that will bring search results.
now i wanna change this to one textfield and a listbox.user can type in textfield and select an option(products or company or category)then click search.
how to make it possible?.
i wanna make all names of <input> tags as same before.i wanna change the name of textfield according to the listbox selection.that i think the quick trick.
anyone plz help
thanks in advance
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the basic idea, I added an onclick on the text bo so you can see how the name changes.

You are just going to have to adapt the code slightly for your application.
Eric
 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Eric,
now the problom is,
i have cut and pasted ur code into my JSP page.
javascript function is pasted inside <head></head>tags and HTML pasted inside <body>tags.
first i got an error message like this
document.Test.D1 is null or not an object.
then i hav changed document.Test.D1 to document.forms[0].D1
now the problom is options is null or not an object.
do u tell me the possible causes for this problom?.how can i resolve this problom?.
appreciating ur help.Eric.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed the code to this:

And it still works.
Things to look at:
Is there 1 or more form tags on the page.
Did you change the name of the dropdown from D1 to something else?
Eric
 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi eric,
thanks a lot.u sent me exactly what i meant.but it would'nt played the trick.
i need ur Validity code.i tried to download it but some error.do u sent me through javaranch?.
with regards,
 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got the validity code..thanks
 
Let nothing stop you! Not even this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic