hub.eb?material_id=375&track_id=368

JavaScript API: Texts


The texts interface acts as a parent object for both Linked Texts and Local Texts. Individual Texts can be accessed using their Text Reference, e.g. texts.myNamedText.

To get the value of a Text the getText() function is used, e.g. texts.myNamedText.getText().

The value of a Text can also be set programmatically using the texts.myNamedText.setText(textValue) function.

Steps


1

Create a new Form and add a Text Control named myTextLabel.

2

Add a Texts entity named myTexts to your Project. You can do this by right-clicking in the Entities view and selecting New > Texts.

3

Add a text item to myTexts using the  icon. Set the Id to successMessage and the Text to Congratulations. Your request was successful.

4

Add myTexts to your Form. You can do this by via Form Properties  > Texts and adding a linked Texts file.

5

Add a Before Form event to your Form and add the following code:

var successMessage = texts.successMessage.getText();
controls.myTextLabel.text.setText(successMessage);
6

Run the form. You will see the success message on the page.

Current Module

Related