I have a form that is partly populated based on values in a selected row of a table. There are 2 controls in particular that I am struggling with:
Segmented control (called PostSpecificSeg) has the options:
- Not Post Specific (value = "generic")
- Post Specific (value = "specific")
Text input (called PostIDtoUse)
What I am trying to get to is:
when "Not Post Specific" is selected (PostSpecificSeg = "generic") then PostIDtoUse should be null.
when "Post Specific" is selected (PostSpecificSeg = "specific") then PostIDtoUse should be the value of post_id in the selected row of dataTable.
I am using 2 event handlers in PostSpecificSeg as follows:
event 1
Action: Control component
Component: PostIDtoUse (Text Input)
Method: Clear value
Only run when: {{ PostSpecificSeg.value = "generic" }}
event 2
Action: Control component
Component: PostIDtoUse (TextInput)
Method: Set value
Value: {{ dataTable.selectedRow.post_id }}
Only run when: {{ PostSpecificSeg.value = "specific" }}
event 2 runs regardless of which value is selected in PostSpecificSeg, and event 1 never runs.
What am I doing wrong?