Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Combobox question.

 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I was wondering if it's possible to make a combobox where you write your own text in the dropdown list.

Ex. The code below creates a textfield aswell as a dropdown list,
I want to be able to write my option in the dropdown lists textfield instead of the one which is generated above the dropdown list.



This is what the <s:combobox/> will look like:


This is how I want it to look:



Is it possible?
If so, how?

Thanks in advance,
Alia
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The autocompleter Dojo tag does this.
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right thank you!
I can't get it to work properly though.
I've tried the following code snippets. (Along with several others that didn't turn into anything)


This code turns into a regular textfield, I've tried it without the %{} , same thing, just a textfield.


This code turns into a regular <s:select/> with the values from the ArrayList in it.

The list I'm trying to populate the autocompleter with, is an ArrayList<String>.

Appreciate the help
Alia
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you include the <sx:head> tag in your pages <head> element?
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did.

Here's the complete .jsp


I tried both <sx:head/> and the one I use above.
Thanks
Alia
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any JavaScript errors on the page or in Firebug? Have you tried it with the "debug" attribute in <sx:head>? Have you confirmed that the network traffic meets with your expectations from the tag usage?
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No there are no java script errors, I just tried with the debug attribute and it shows the following message: "FATAL exception raised: Could not load 'dojo.debug'; last tried '__package__.js'
DEBUG: DEPRECATED: dojo.io replaced by dojo.io.* -- will be removed in version: 0.5"

What do you mean by:
Have you confirmed that the network traffic meets with your expectations from the tag usage?


I've tried the autocompleter out by writing something in the box then pressing save, and the value gets inserted into the database, just as I've expected. And I'm sure it recieves the list since it shows the list as a select if I use the following code:



/Alia
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait, you're trying to use an autocompleter as a non-Ajax component? I don't know if you can do that.
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well not intentionally. What is it I've forgotten to write in the jsp code that makes it into a non-ajax try?
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to fix it, apparently I had to change

to


Thanks for your help!
Regards
Alia
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic