Question
ED Coder · Jan 6, 2021

How to Get value from zen component

I am new to zen pages, and trying to see how to get the value of a control.

Below is what I have

<combobox id="comboboxEdit" label="Select">
<option value="1" text="1" />
<option value="2" text="2" />
</combobox>

<button id="appointments" label=" " caption="Fetch" onclick="zenPage.Fetch();hidden="false"/>


ClientMethod Fetch() [ Language = javascript ]
{

// how can I get the value of the controls here? can I do something like document.getElementById()?

}

 

Product version:
Ensemble 2017.1
00
2 0 3 44

Replies

You can get the value by : zenPage.getComponentById('dtfrom').value;

Note - it's generally better practice to use

zenPage.getComponentById('comboboxEdit').getValue()
or equivalently (and shorter),
zen('comboboxEdit').getValue()

super. thank you for the best practice guidance