on 02-20-2005 1:30 PM
Hi all,
there are three dropdownListBox in my application.
if i select the listitem from first dropdownlistbox accordingly the listitems of the second dropdownlistbox should be updated.
for eg: if i select vegetables in my first dropdownlistbox then accordingly the second dropdownlistbox should get the vegetable names from the vegetable table in the database and display....and so on...
if i select fruits in my first dropdownlistbox then accordingly the second dropdownlistbox should get the fruits names from the fruits table in the database and replace the vegetable list before and display......
kindly help me in this regard.
regards,
Joshua
Hi Joshua,
When you define your drop down list box, use something like this;
<code>
DropdownListBox myDd = new DropdownListBox("myDd");
myDd.setModel(getListModel());
myDd.setOnSelect("onFolderSelect");
</code>
because you've set a 'setOnSelect', when your user selects something from the dropdown an event occurs and the iView is refreshed. I'm sure you know that much already.
You can see that the drop down model is being assigned from a method, this method will obviously return a DefaultListModel. Inside just have some logic that determines what the DefaultListModel that is returned contains.
<pseudo-code>
if(dropdown1.getSelection()==fruit){
return a ListModel containing fruit;
}else if(dropdown1.getSelection()==vegetables){
return a ListModel containg vegetables;
</pseudo-code>
I hope this helps,
Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From what I understood you need to know how to update those dropdownListBoxes, isn't it?
If these is your question, here's what you have to do:
If you create the dropdownListBoxes in jsp, the htmlb tag dropdownListBox has an atribute <b>onSelect</b>. If you create the dropdownListBoxes in java there is a method in DropdownListBox class named <b>setOnSelect</b>.
The value has to be the name of a function where you will define the action that will be processed when the user clicks on the enabled dropdownListbox. If for example the name you have chosen is <i>selectFirstList</i>, in the class that extends JSPDynPage you will need to have
public void selectFirstList(Event event) throws PageException
or
public void onSelectFirstList(Event event) throws PageException
In this function you will have to acces the database, obtain the result and pass it to the dropDownListBox. You will also need to create a model for the dropdownListBox.
My suggestion is to consult the java development content. There you will find some examples.
For the htmlb tags check this site: http://www.sapdesignguild.org/resources/htmlb_guidance/index.html
Hope I made my self understood and Good Luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.