|
|
|||||||
Hi There I'm putting together a kixform that sets allow/deny logon hours for a group of students in AD. I need to be able to cycle through 25 checkboxes on a kixform and action a function call whenever a checkbox is ticked. The boxes are named $CheckBox1 to $CheckBox25. Is it possible to convert a string into a variable name? If so, how? For example, it would be nice to be able to do: Code:
But I'm not sure if "somefunction" exists or even if this is possible? Can someone offer any ideas? Cheers |
||||||||
|
|
|||||||
Somefunction is something you'd write yourself, thus you should know whether it exists. |
||||||||
|
|
|||||||
I don't get it. Regardless of which checkbox is checked, your psuedo-code would perform the same action since there is only one action in the loop. That, and correct me if I am wrong, but I don't think checkbox has a value property. What I think you need to do is to check the checkbox.checked property on each one and perform the specific action accordingly. |
||||||||
|
|
|||||||
BTW, you can build dynamic $CheckBoxX.checked code constructs using Execute() but as I mentioned above, I don't see the point in it since at some stage in the code you will have to enumerate them individually anyway. |
||||||||
|
|
|||||||
Adn you should always use Code:
as it makes coding KiXforms scripts a lot easier. |
||||||||
|
|
|||||||
check out the Execute() Function For example (not tested at all) Code:
|
||||||||
|
|
|||||||
Hmmm... NoVarsInStrings non-compliant... How far is Pittsburgh from Boston? |
||||||||
|
|
|||||||
a safe distance away |
||||||||
|
|
|||||||
just change: $ = Execute("$$checked = $$Checkbox" + $j + ".Checked") to: $ = Execute("$"+"checked = $"+"Checkbox" + $j + ".Checked") and it is compliant. actually, I think kixtart acts wrong there. even though no vars in strings is turned on, double dollar should be translated to single, just like manual says. |
||||||||
|
|
|||||||
Thanks for that Maciep (and Lonkero for correction). Just what i didn't know and works as required. As to Les's comment, I was trying to show what the construct was that i wanted NOT the exact use for the construct. Sorry if it fazed you. Appreciate all the excellent thoughts. |