Laura Cavanaugh · Jun 16, 2016

How to use <radioSet> and set its value


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:

<radioSet id="appRadio" name="appRadio" 
displayList="App One,App Two,App Three" 


I want to select a radio based on a sepcific value, that I get from code.


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           //?





0 483
Discussion (4)2
Log in or sign up to continue

Your last example is really close - probably just the typo in the component ID that's the problem.

Class DC.ZenRadioOnLoad Extends

/// This XML block defines the contents of this page.
XData Contents [ XMLNamespace = "" ]
<page xmlns="" title="">
<radioSet id="appRadio" name="appRadio" 
displayList="App One,App Two,App Three" 

/// This callback is called after the server-side page 
/// object and all of its children are created.<br/>
/// Subclasses can override this to add, remove, or modify 
/// items within the page object model, or to provide values
/// for controls.
Method %OnAfterCreatePage() As %Status
    Set ..%GetComponentById("appRadio").value = "Three"
    Quit $$$OK


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,


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.