Displaying field's caption within the field

The HTML placeholder attribute can be specified within the Additional Attributes area of the field(eg. placeholder="type your email"). However, within a multi-language website, you may wish to have a different translation.

1. Preparation

We'll use a "textbox" field with the following configuration:

  • First things first, the language for which you edit the form can be changed from the language selector dropdown (located in the upper-left corner while editing a form).
  • You will have to specify for each language of your website a caption on the textbox field(simply change the language, add a caption and repeat this process for every language of your website).
  • Now we can add the following additional attribute to the textbox field:



You will have to replace "my-textbox-name" with the exact name of your field.

2. Script

Add the following script within "Scripts called on form Display area" (backend > Components > RSForm!Pro > Manage Form > select your form > Properties > PHP Scripts):

$formLayout = str_replace($find,$replace,$formLayout);

Explanation: The script changes the placeholder value with the according caption when the form is displayed.

Tip: Since you'll be using this placeholder attribute approach, the caption of the field (which is added automatically to the form's layout by default) is no longer needed and can be removed by performing layout adjustments(backend > Components > RSForm!Pro > Manage Forms > select your form > Properties > Form Layout).

10 persons found this article helpful.

Was this article helpful?

Yes No
Sorry about that