How to use <radioSet> and set its value
Hello,
I have a question about how to set the value of a radioSet. Yes, I know -- the documentation says that setValue can be used "client side", but gives no example. Plus, I'm trying to set the value of a radioSet in %onAfterCreatePage, which is a Zen method? Server side method? I'm not sure.
In my Zen page I create a radioSet like this:
displayList="App One,App Two,App Three"
valueList="One,Two,Three"/>
I want to select a radio based on a sepcific value, that I get from code.
e.g.
Method %OnAfterCreatePage() as %Status
set value = class.aMethodThatReturnsAValue() //e.g. "Two"
set %page.GetComponentById("appRadio").setValue(value)
Nope. That does not compile.
set %page.GetComponentbyId("appRaiod").value = value //?
Thanks,
Laura
Your last example is really close - probably just the typo in the component ID that's the problem.
Oh! Yes, that is working. I had a recursive compile error that I had to fix first (two classes were dependent on each other.. caused a 2-hour delay), and then I had to fix a little logic error in my code.
That radioSet looks quite useful.
Thank you,
Laura
Methods in Zen classes declared with "Method" or "ClassMethod" are all server-side. These may also have the ZenMethod keyword, which allows them to be called from javascript (e.g., zenPage.MethodName().)
If you want to have a JavaScript method in a Zen class, the method should be declared as a ClientMethod with [Language = javascript].
A useful convention you'll see in %ZEN is that server-side, non-ZenMethods have names starting with %, ZenMethods (Methods or ClassMethods with the ZenMethod keyword) start with capital letters, and ClientMethods start with lower case letters. It's useful to follow the same convention when you build your own Zen pages.