show / hide menu

GetControlId function

This document will explains about how we can use the function GetControlId() in ClaySys AppForms. The function will returns the HTML ID of the control. To get the control ID of a particular control you need to call the function and set the result to any text control to make access on the value.


You need to pass the control name as the parameter to the function and it will return the control ID of the control.


Write a rule with GetControlId function and put it in a message box and when triggering the rule you can see the control ID of the control in a message box.


Now we are going to change the Background color of one text-box in our form by using the Control ID in a JavaScript.

  1. For this open the form and then place a text-box and one button control.

2. Create a variable named jsID

3. Set the value to the variable as below image.

4. Write the rule to execute the JavaScript in the trigger of the button control.

Here we are just simply the pass the variable name jsID which holds the control ID of the text-box.

5. Load the form and click on the button and trigger the Rule to execute the JavaScript and you can see that the code works.

This is one of the simplest example for using the GetControlId function and you can work with control ID when it gets and it is similar as using the control name.