participate


Sun Java Studio Creator - Databound Dropdown and Dummy Value
<<   Back to Forum  |   Give us Feedback
This topic has 9 replies on 1 page.
Eke_ny
Posts:12
Registered: 12/10/06
Databound Dropdown and Dummy Value   
Feb 8, 2007 10:44 AM

 
Hi There,

There's a databound UI:DROPDOWN on a page, let's say the dropdown shows the countries. I wanna insert a dummy value, let's say "Please select a country", and make this value as selected. How can I manage this with SJC?
 
aerostra
Posts:20
Registered: 2/9/07
Re: Databound Dropdown and Dummy Value   
Feb 9, 2007 5:43 AM (reply 1 of 9)  (In reply to original post )

 
You could do it using the way I did: change your database table to have the dummy value i.e.:

id country
--
1 Please select a country
2 Australia
3 Africa
4 America


Then you can do all your bindings accordingly, if it's ordered by id, then the "please select a country" will appear as the default. I believe there is another way to add it by code but I found it easier to modify the database table!
 
yossarian
Posts:199
Registered: 08/10/06
Re: Databound Dropdown and Dummy Value   
Feb 9, 2007 10:55 AM (reply 2 of 9)  (In reply to #1 )

 
Assuming your items are an array of Option the thing you are probably looging for is an OptionTitle which you can add directly to the array and performs as you require.
 
yossarian
Posts:199
Registered: 08/10/06
Re: Databound Dropdown and Dummy Value   
Feb 9, 2007 1:36 PM (reply 3 of 9)  (In reply to #2 )

 
And make sure you get all your target countries in the dropdown... Most sites are missing at least one of : Angola, Sudan, Zimbabwe, Sao Tome, Mozambique. It's extreamly irritating to have to enter a form with a drop down list that doesn't have the required items in it.
 
Eke_ny
Posts:12
Registered: 12/10/06
Re: Databound Dropdown and Dummy Value   
Feb 9, 2007 2:26 PM (reply 4 of 9)  (In reply to #1 )

 
Well, actually adding a dummy value for each databound dropdown would require a lot of work. I'm wondering how to manage this programmatically.

Thanks.
 
yossarian
Posts:199
Registered: 08/10/06
Re: Databound Dropdown and Dummy Value   
Feb 10, 2007 12:38 AM (reply 5 of 9)  (In reply to #4 )

 
I made a request bean that generates an array of option from the underlying data and adds the dummy value. Obviously a similar approach with an application bean would work too.
 
Eke_ny
Posts:12
Registered: 12/10/06
Re: Databound Dropdown and Dummy Value   
Feb 12, 2007 9:59 AM (reply 6 of 9)  (In reply to original post )

 
Well, I've found that if I use standard components, that is h:selectOneMenu, I could add dummy value with f:selectItem. What I'm curious whether such thing is possible with ui:dropdown.
 
kish@sun
Posts:371
Registered: 6/8/03
Re: Databound Dropdown and Dummy Value   
Apr 6, 2007 1:03 PM (reply 7 of 9)  (In reply to #6 )

 
Hi Folks,

Please take a look at this new techtip, which describes how to accomplish what you are looking for

http://www.netbeans.org/kb/55/dropdowncomp.html

Thanks
K
 
kish@sun
Posts:371
Registered: 6/8/03
Re: Databound Dropdown and Dummy Value   
Apr 20, 2007 2:16 PM (reply 8 of 9)  (In reply to #7 )

 
Hi folks,

was the techtip of help? Does it do what you are looking for? Please provide feedback.

Thanks
k
 
Eke_ny
Posts:12
Registered: 12/10/06
Re: Databound Dropdown and Dummy Value   
Apr 21, 2007 11:56 AM (reply 9 of 9)  (In reply to #8 )

 
The techtip on the page you mentioned was of GREAT help and it ACTUALLY DOES TELL what I asked on the forum. It was a great job of you.

Thanks
 
This topic has 9 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 22
  • Guests : 132

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums