22
Views
7
Comments
Solved
How to populate the input with the clicked value to edit it? (Weblock)

I have a context where there are sections and a section can have multiple items.


A item can have rules. There is a Rules entity section. A Item can have many rules and a rule can be in multiple items so there is a many to many relationship between items and rules.


I have a popup "NewItemPopUp" for the user to create new items and also edit existing items that belong to a specific section.


In this popup the user can select a rule from the static entity "Rules", the rule can be A, B, C or D. And then have a add button for the user to add a new rule to the item inside the popup. The rules associated with the item appear at the bottom of the popup using a web block "ItemRulesWB".


In this web block is possible to remove rules, there is a icon with a link for a delete action. 


Issue: I would also like to have a edit icon with a link to edit. My doubt is how to click in that edit link and populate the form with the rule clicked to change it?


I have a OML with the issue , the flow is in the TestSscreen. To test probably you need to create first a template then when you click in a template in the table records you can create new sections. Then is possible to create items inside a section and then the issue is in the NewItemPopUp and in the ItemRulesWB.


Thanks!




EditRule.oml

Rank: #94
Solution

Hello Jake,

Hope you're doing well.

Following up on Grace's suggestion, I made a couple changes in your OML file.

Not only I added an Event in ItemRulesWB block and an Handler in NewItemPopUp screen to retrieve the ItemRuleId that you pretend to edit, but I also changed your logic a bit to control if the application should add or edit a new ItemRule. You can verify these changes in your AddRule and Handler_Edit screen actions.


Can you verify if this is what you are looking for? :)

Please refer to attached OML file.


Hope that this helps you!


Kind regards,

Rui Barradas

EditRulepopupv1.oml

Rank: #2211

You may use an event in the webblock that could pass the rule back to the parent screen. Then on the parent screen, you would just need a handler for the event that would set the rule in the form.

Rank: #17080

The ItemRules entity can have more fields like Order for example, Updated OML:

EditRulepopup.oml

Rank: #94
Solution

Hello Jake,

Hope you're doing well.

Following up on Grace's suggestion, I made a couple changes in your OML file.

Not only I added an Event in ItemRulesWB block and an Handler in NewItemPopUp screen to retrieve the ItemRuleId that you pretend to edit, but I also changed your logic a bit to control if the application should add or edit a new ItemRule. You can verify these changes in your AddRule and Handler_Edit screen actions.


Can you verify if this is what you are looking for? :)

Please refer to attached OML file.


Hope that this helps you!


Kind regards,

Rui Barradas

EditRulepopupv1.oml