Choosing drop down value to unlock different fields.

0
Hi Mendix people. I have 3 competitors that I want to pick from drop down. The competitor’s name is stored in the dictionary entity(one attribute with name of competitor in string), and the details in CompetitorItemDetails entity. Both entities have an association with the NP entity of the page context. In CompetitorItemDetails I have a field that holds a competitor’s name. Here’s what I want to achieve, but I don’t know how: I want to select a competitor from drop down(from dictionary entity), then unlock the fields with the details for editing(blocked for each of three competitors until selected from drop down, from CompetitorItemDetails entity), then after pressing save button, save all data to CID entity together with the competitor’s name. And I want to be sure that at least one competitor will be selected and completed to allow save and proceeding. And a useful option, but not 100% required, would be that after choosing the first competitor, in the second drop down he would not appear anymore.  Sorry for so much text to read. I look forward to hear your response. Mateusz
asked
1 answers
0

Hi Mateusz, 

I will try to break down your question and answer the individual sections:


1. I want to select a competitor from drop down
To do this you can create an association from your page context object (I believe it is FilterContext in this case) and you make a reference selector to select the association to the dictionary entity.
 

2. Then unlock the fields with the details for editing (blocked for each of three competitors until selected from drop down, from CompetitorItemDetails entity)
You should put conditional editability on all of the fields that you don't want to be editable as long as the association from FilterContext to Dictionary is still empty. Then, when a Dictionary is selected, the fields will automatically become editable. 

3. then after pressing save button, save all data to CID entity together with the competitor’s name.
If you press the save button, you will have the page context object as an input parameter in your micro/nanoflow and you should be able to retrieve all information from this object. 
 

4. And I want to be sure that at least one competitor will be selected and completed to allow save and proceeding.
In the microflow that is under the save microflow you should make sure that the association from the page context to Dictionary is not empty.

5. And a useful option, but not 100% required, would be that after choosing the first competitor, in the second drop down he would not appear anymore. 
In the second dropdown, you can select a microflow as datasource. Then filter out the first selected competitor and return the rest of the list. Be sure to retrieve over association and not over database, as your first selected competitor is not yet in the database.
 

 

 

 

answered