Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bullet Lists in Forms: Hide/Unhide Text Field and Bullet Points Based on Previous Text Field

Community Beginner ,
Oct 14, 2022 Oct 14, 2022

I found out how to hide a text field (or fields) based on if data is entered into another text field. Meaning, a text field is hidden if nothing is entered into another one elsewhere in the form. Is it possible to hide/unhide bullet points adjacent to the text field depending on whether it's hidden/unhidden. Screenshot of form attached. Any help would be greatly appreciated. Thanks!

 

I currently hide/unhide text fields with the below script, but cannot figure out how to hide/unhide the corresponding bullets.

 

this.getField("Target field name").display = (event.value=="") ? display.hidden : display.visible;

TOPICS
Create PDFs , How to , JavaScript , PDF forms
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Beginner ,
Oct 15, 2022 Oct 15, 2022

Picture attached. I would like to type into UA1 and have a bullet appear at B2 and UA2 text field to become active

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

You can use this script in one of the fields as 'Custom calculation script' it will work for all fields:

 

for(var i=1; i<=4; i++){
if(this.getField("UA"+i).valueAsString != ""){
this.getField("UA"+(i+1)).display = display.visible;
this.getField("B"+(i+1)).display = display.visible;}
else{
this.getField("B"+(i+1)).display = display.hidden;
this.getField("UA"+(i+1)).value = "";
this.getField("UA"+(i+1)).display = display.hidden;}}

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

Use read-only text fields for the bullets and show/hide this fields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 15, 2022 Oct 15, 2022

Thanks for your reply. Could you elaborate about the scripting or setup. Also, the above script for the text fields only worked for "Field A" to "Field B", but not the others (C, D, and E). I found the below script and input it into "Field A" and now works for successive fields.

 

this.getField("Field B").display = (event.value=="") ? display.hidden : display.visible;

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 15, 2022 Oct 15, 2022

Correction: Input script in Field A-D, just changing "Target Field Name" accordingly.

 

I just need to know how to apply similar logic to the corresponding bullet points. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

The same way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 15, 2022 Oct 15, 2022

I am not able to successfully apply the above script to the 5 rows of "bullet text fields". I am able to use the above script to make the "text entry fields" successively appear/become active, but the "bullet" text fields are a fixed entry, dependent on the adjacent "text entry field". I basically need an if/then statement: If text is in Field 1 then have a bullet appear adjacent to that row. Tried toggling to "read-only" for bullets. Really appreciate the help, this is quite new to me.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 15, 2022 Oct 15, 2022

Picture attached. I would like to type into UA1 and have a bullet appear at B2 and UA2 text field to become active

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

Set the default value of "B2" to be the bullet character, and set it as read-only.

Then use this code as the Calculation script for "UA1":

if (event.value=="") {
	this.getField("B2").display = display.hidden;
	this.getField("UA2").display = display.hidden;
	this.getField("UA2").value = "";
} else {
	this.getField("B2").display = display.visible;
	this.getField("UA2").display = display.visible;
}

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

You can use this script in one of the fields as 'Custom calculation script' it will work for all fields:

 

for(var i=1; i<=4; i++){
if(this.getField("UA"+i).valueAsString != ""){
this.getField("UA"+(i+1)).display = display.visible;
this.getField("B"+(i+1)).display = display.visible;}
else{
this.getField("B"+(i+1)).display = display.hidden;
this.getField("UA"+(i+1)).value = "";
this.getField("UA"+(i+1)).display = display.hidden;}}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 22, 2022 Oct 22, 2022
LATEST

Thank you both for your help!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines