Copy link to clipboard
Copied
hi,
i have a form where i want to dispay the descriptive text if its field is not empty. if the field happens to be empty i want the text to be hidden.
NAME ______________
if the user doesnt fill in the Name_Field, i do not want "NAME" to show.
i tried doing this by making Name_Text field and using condition to show "NAME" if Name_Field is not empty. i couldnt get it work. is there an easy way to get this done?
Copy link to clipboard
Copied
As the custom Format script enter the following code:
if (event.value) event.value = "NAME " + event.value;
This will prevent the value the user entered from actually being edited, and will also not add the fixed text multiple times each time you edit the field...
Copy link to clipboard
Copied
In the script i gave you just change event.value to "NAME" like this:
this.getField("Name_Text").value = event.value == "" ? "" : "NAME";
Copy link to clipboard
Copied
As validation script of "Name_Field" field use this:
this.getField("Name_Text").value = event.value == "" ? "" : event.value;
Copy link to clipboard
Copied
thanks for the quick response. appreciate it. tried the code but it copies the "Name_Field" data into "Name_Text" field. i would like the "Name_Text" field to show "Name" if any data has been entered into "Name_Field"
Copy link to clipboard
Copied
As the custom Format script enter the following code:
if (event.value) event.value = "NAME " + event.value;
This will prevent the value the user entered from actually being edited, and will also not add the fixed text multiple times each time you edit the field...
Copy link to clipboard
Copied
Sorry, I thought this was a single field. Do you have one field for the label and another for the actual text?
Copy link to clipboard
Copied
> i need to show a field's text description only if the field is not empty
What want you show when the field is empty?
Copy link to clipboard
Copied
if "Name_Field" is empty i want "Name_Text" to be empty
if "Name_Field" has any data i want "Name_Text" to show "Name"
Copy link to clipboard
Copied
You can change the visibility of the label.
Copy link to clipboard
Copied
thank you so much @Nesa Nurani @try67. i got it to work as i wanted
For "Name_Text" i used
if (event.value) event.value = "NAME ";
and for "Name_Field" i used
this.getField("Name_Text").value = event.value == "" ? "" : event.value;
Copy link to clipboard
Copied
In the script i gave you just change event.value to "NAME" like this:
this.getField("Name_Text").value = event.value == "" ? "" : "NAME";
Copy link to clipboard
Copied
this does the work as well. thank you so much.

