hub.eb?material_id=292&track_id=291

Get and Set Field Values from the Browser


A Field's Client Acccessibility property determines its level of access to the Client-Server API and therefore the browser:

  • Inaccessible the Field cannot be accessed by the browser.
  • Read the Field can be read by the browser but not updated.
  • Read/Write the browser has full access to the Field.

The Client Accessibility property does not affect the Verj.io Runtime Environment's ability to manipulate the field.

You can read a Field value from the browser by using $eb.getFieldValue("myField"), this returns the value of the Field in the appropriate format for the Field's type.

You can modify the value of a Field from the client by using $eb.setFieldValue("myField", 1).

You can also pass additional parameters to this function:

  • autorefresh instructs the AJAX mechanism to refresh the page with any resultant changes.
  • failureCallback a function that will be called if the field cannot be found or written to.

Steps


1

Create a Form. Add a Field called counter and set:

  • Type = Integer.
  • Default value = 0.
  • Client accessibility = Read/Write.

Drag the Field onto the Page and set the resulting Field Control to Display only in it's Properties View.

2

Add a Button Control and set the text to Increment.

Add an onclick HTML Event Handler in the Button Control's HTML Element Properties with the following code:

$eb.setFieldValue('counter', $eb.getFieldValue('counter') + 1, true);
3

Run the Form.

Clicking the button will increment the Field value from the browser.

Current Module

Related