how to add the disappear into in string field

vits18735a0
Tera Contributor

i am creating the filed , with name comment and data type is string. and than i added default value as please add comment. when user click on the field the default value need to erase . how can i achive that. 

vits18735a0_0-1750489343953.png

 

2 ACCEPTED SOLUTIONS

@vits18735a0 Did you give the script above a try? It works the same way—the placeholder shows only when the field is empty. Once the user types something or clicks into the box, the placeholder disappears automatically.

Don't use the default value here...

View solution in original post

@vits18735a0You can use a single client script to add placeholders to multiple fields—there’s no need to create separate scripts for each one.

Sample:

function onLoad() {
    var placeholder_1 = g_form.getControl('field_1');
    if (placeholder_1) {
        placeholder_1.placeholder = 'Enter your text here';

    }
    var placeholder_2 = g_form.getControl('field_2');
    if (placeholder_2) {
        placeholder_2.placeholder = 'Enter your text here';

    }
}

 

View solution in original post

7 REPLIES 7

J Siva
Tera Sage

HI @vits18735a0 
Create one OnLoad client script like below to add a placeholder value.

JSiva_0-1750490635838.png

function onLoad() {
    var ctrl = g_form.getControl('u_comments'); //CHANGE THE FIELD NAME AS REQUIRED
    if (ctrl) {
        ctrl.placeholder = 'Enter your text here';

    }
}

Regards,
Siva

 

Hi j siva, 

Thanksd for the replay, now i understand that we are able to show the default msg in the field. 
but what if we alreday have the default for the field , so is it also remove like the onload functionality.

@vits18735a0 The default value is different from the placeholder. If a default value is configured for the field, it will be displayed instead of the placeholder.

Are we able to remove the place holder , like we did for placeholder? 
expected : once user click on the field than default msg need to remove.