13
Views
12
Comments
Combobox depend on the selected value
Question

For example

I have combobox with value first and second how can I show combobox1 or combobox2 depend on selected value in combobox? I thought about sth easy like

if(combobox.value == "first" )
show combobox1
else if (combobox.value == "second" )
show combobox2

but i cann't do it in agile platform. I tried use boolean local variable and change visible comboboxes but it doesn't work properly. anybody can help me?

UserImage.jpg
André Santos
Hello Norbert, 

Did you refresh the invisible combobox after changing the visible property? Try to use the ajax refresh widget. It will do the trick.

UserImage.jpg
Norbert Blandzi
Yes, I used ajax refresh but my problem is that I don't know what I should check and compare. I mean I don't know what should I use as "value" in combobox.value in my example because I can't find sth like combobox.value when I set condition for "if" there are only Id, SpecialListValue, Valid, ValidationMessage. I tried combobox.speciallistvalue = "first" but it didn't work
UserImage.jpg
André Santos
Ok, here is an example OML. Hope it helps. 

Choose the admin to show combo2. (I assume you have "Users" espace with sample data)

The selected value is assigned to the combo variable. You have to set the combo's variable to a local variable (or an attribute of an entity if the combo is in an EditRecord) in the combo properties.

Feel free to ask any questions. 
ComboExample_v5.oml
UserImage.jpg
Norbert Blandzi
I changed your OML file. It would be nice if you'll change this file to show combobox2(selected "first" in combobox1)/combobox3(selected "second" in combobox1) depend on which variable will be selected in combobox1
ComboExample_v6.oml
UserImage.jpg
André Santos
Here you go.

You have to create a "dummy" structure for the combobox. 

Hope it helps.

Feel free to ask any questions.

ComboExample_v13.oml
2020-10-15 10-24-31
Miguel Seabra Melo
I believe Norbert may have been thinking of a slightly different scenario: select from a single combo either "first" or "second" and have a different child-combobox appear. Am I correct?

In this case, if you want the edit-mode screen to better "show" that combo's 2 & 3 are mutually exclusive while in runtime, would be to place these "child" comboboxes into the TRUE and FALSE parts of an IF to which you specify a name (like "ComboSelectorIF").

Then, on the onChange as André exemplified, you would set a single Boolean var (the one that is used by the IF) and refresh the "ComboSelectorIF". This will make one of the child-combos appear and the other disappear.

Let me know if this helped,

Miguel
UserImage.jpg
Norbert Blandzi

André!

Thanks for your help, "OML" is very useful and it works like I want!

UserImage.jpg
André Santos
No problem Norbert!

I'm glad you accomplished what you wanted! 

Cya around!
UserImage.jpg
Norbert Blandzi
I have problem connected to the previous so I decided put it here. In eSpace which I uploaded I want generate XML file ( I know that exist XML records but I want do it in my own way) from user input but I can't get value of current selected combobox. My problem is in "Createconfig" action in "router" assign. Anyone can help me with generete output with included router name?

PS. Miquel I just saw your post, yes you are right but I Andre's example explained me how it works and I used it without difficulties for my problem.
Converter.oml
UserImage.jpg
André Santos
Hello again Norbert, 

Currently you are using the special list, you will have to populate the Combo1Lists RecordLists with the values you have in your special list in the preperation action.

I changed your OML a little.

Hope it helps.
Converter.oml
UserImage.jpg
Norbert Blandzi
Andre you are my hero :)
Thanks again for help
UserImage.jpg
André Santos
No Problem!

Cya around
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.