How to iterate through form item controls inside RuntimeModifications?
Does anyone have ideas/examples of how to loop through each form item? I want to evaluate the FormItem ID, so I can set a property (in my case set a CheckBox to checked).
I'm trying to load the form with certain Check Boxes pre-checked. I know the Argument Names for the ones I want checked but not the IDs (CheckBox1, CheckBox2 etc.).
I'm familiar with the Assign concept of:
form.Find(Of CheckBoxFormItem)("CheckBox1").Checked = True
I'm just looking for an easier way than adding 30+ Assigns and matching them to the Argument Names on the form.
I guess I could also say "How do I find a FormItem ID using the Argument Name?"
phil.
0
-
Use the Form Results out argument of the Display Form.
This is a dictionary with the argument name as key and the value of the form item as value.
You can loop through this dictionary.0 -
My example above is to get the value afterwards. I see now you want to get the argument name in the runtime modification. 0 -
Was just looking for this myself.
Think I have found the solution..... by looping through all the form.FormItems in the runtime modifications.
So.....
1. Create a form and add all relevant checkboxes to the form
2. in the "runtime modifications" add a ForEach activity
3. change the TypeArgument on the ForEach activity to "Geocortex.Forms.Client.Items.FormItem"
4. add an if statement to the loop so we only tick the Checkboxes (not other types of form items). If the item is a checkbox add an Assign activity to "tick" the box.
E.g. The if statement would be like:
If item.ItemID.Contains("CheckBox")
Then
form.Find(Of CheckBoxFormItem)(item.ItemID).Checked = True0 -
Sorry just read your description again, but if you want to tick checkboxes based on the the ArgumentName then just change the if statement or change it to something like a switch statement 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
4 Kommentare