Hands-on Practice

Practice scripting for dynamic e-Form by yourself according to the guide.

Target Form

Example

Requirements

Item
Description

NRIC

Auto tab (auto-focus to the next)

Birthdate

Month: put items with scripts

Country

Select "Singapore" or "Singapore PR" -> hide country_other

Select "Others" -> show country_other

Smoker

Check "Yes" -> show the BMI band

Check "No" -> hide the BMI band

Set the OZFormParam smoker="Yes" -> show the BMI band

Set the OZFormParam smoker="No" -> hide the BMI band

BMI band

Calculate Index with Height and Weight

Plan

Show the Price 0 for Trial,100 for Standard, and 200 for Premium

From

When changing the From date, increase the To date by one year

To

Set the default date to one year after the current date

Radio button groups

When group1_y and group2_y radio buttons ticked, tick the agree_all checkbox automatically

"agree_all" checkbox

When ticked the agree_all checkbox, tick group1_y and group2_y radio buttons automatically

Full name & Signature

Open both SignPads in a single pad (give them the same group name)

Signature

When created the signature, show the signed date-time under Signature

Remove File button

Remove the file added by AttachmentButton

Blinking required fields

Set Required to true. Apply viewer options for blinking

Input validation

Add a button to check if there are any missing fields

Implementation

1. Viewer options

2. Auto tab

  • Create a global function autoTab in the Functions event of the ReportTemplate.

  • Call the function in the OnValueChanged of each single-digit textbox (n1 to n8).

3. Put items to birth_mm

  • Remove items from the Items property.

4. Show/Hide country_other for input

  • Set Visible of country_other to "false".

5. Add a form parameter

  • Add a parameter smoker to the OZFormParam.

  • Set its value to "Yes".

6. Tick smoker_y & smoker_n by smoker parameter value

  • Set the smoker to "No".

7. Show/Hide band_bmi by the smoker parameter value

  • Set the smoker to "Yes" and try to preview.

8. Set smoker value from "Yes/No" of Smoker

  • Tick Yes -> Set smoker to Yes

  • Tick No -> Set smoker to No

9. Calculate BMI (Body Mass Index)

10. Update Price when Plan changed

11. Set plan_to to one year later than plan_from

  • Point "_FormatDate" in the Script Editor and hit <F1> key.

12. Tick agree_all when both group1_y & group2_y ticked

  • Set properties of agree_all:

    • CheckedValue = "y"

    • UnCheckedvalue = "n"

13. Tick group1_y & group2_y by ticking agree_all

14. Date signed

  • Set the FormID of date_time label to date_time.

15. SignPadGroup

  • SignPad has no Group Name in the Properties window.

16. Button to remove the attached file

17. Input validation

  • Add a button submit and put scripts.

18. Styling of required fields

  • Set Required of all required fields to "true":

  • name, gender(RadioButtonGroup), agree_all, full_name, signature

πŸ‘‰ Save your form as company_id/user_id/customer.ozr.

Challenge

Try to challenge yourself with an advanced example.

  • Switch between two bands at the same position.

Example

Last updated

Was this helpful?