Highlighted

different default texts to appear in a fillable blank depending on the result of a pulldown menu.

New Here ,
Jun 13, 2020

Copy link to clipboard

Copied

I would like to have different default text appear in a  fillable blank depending on the results of a pull down menu.

 

I have been able to sorta get what I want with this JS in the custom calculation script box in the calculation tab of the text box:

 

if ((this.getField("County").value =="056") &&(!event.value)) {event.value = "DEFAULT LANGUAGE for 056"};

if ((this.getField("County").value =="015") &&(!event.value)) {event.value = "DEFAULT LANGUAGE for 015"};

 

It  works if the default setting for the pulldown is not 56 or 15 (which are the two most popular choices) AND the user is confident and moves through everything smoothely. 

 

However, if the user chooses 56 and then changes his mind to 15 the default language for 056 stays in the blank. Also it doesn't work if the default is 56 and the user wants 15 or any other County.

 

I would like it so that if 56 is chosen from the menu then the 56 default language fills the blank,  and  if the user then choses 15 from the menu the 15 default language appears. If some other county is chosen the blank is empty. Also I want the user to be able to modify the default text(which she can do in the above script), and not have to start typing form scratch, if she doesn't want the exact default (similar to what happens if there is only one default which is put in the options tab default blank.). Also I would very much like 56 to be the default menu setting.

Views

169

Likes

Translate

Translate

Report

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

different default texts to appear in a fillable blank depending on the result of a pulldown menu.

New Here ,
Jun 13, 2020

Copy link to clipboard

Copied

I would like to have different default text appear in a  fillable blank depending on the results of a pull down menu.

 

I have been able to sorta get what I want with this JS in the custom calculation script box in the calculation tab of the text box:

 

if ((this.getField("County").value =="056") &&(!event.value)) {event.value = "DEFAULT LANGUAGE for 056"};

if ((this.getField("County").value =="015") &&(!event.value)) {event.value = "DEFAULT LANGUAGE for 015"};

 

It  works if the default setting for the pulldown is not 56 or 15 (which are the two most popular choices) AND the user is confident and moves through everything smoothely. 

 

However, if the user chooses 56 and then changes his mind to 15 the default language for 056 stays in the blank. Also it doesn't work if the default is 56 and the user wants 15 or any other County.

 

I would like it so that if 56 is chosen from the menu then the 56 default language fills the blank,  and  if the user then choses 15 from the menu the 15 default language appears. If some other county is chosen the blank is empty. Also I want the user to be able to modify the default text(which she can do in the above script), and not have to start typing form scratch, if she doesn't want the exact default (similar to what happens if there is only one default which is put in the options tab default blank.). Also I would very much like 56 to be the default menu setting.

Views

170

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jun 13, 2020

Copy link to clipboard

Copied

Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 13, 2020

Copy link to clipboard

Copied

I have an Adobe Acrobat DC Pro.

But  a lot of the people using the form will be using Reader.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Jun 14, 2020

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Jun 14, 2020

Copy link to clipboard

Copied

(I've merged your reply back to this thread, please don't start a new thread for each reply)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Jun 14, 2020

Copy link to clipboard

Copied

Remove this part of the code:

&&(!event.value)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
jwpotter LATEST
New Here ,
Jun 14, 2020

Copy link to clipboard

Copied

Thank you.

 

I had trouble with the tutorial you suggested (https://acrobatusers.com/tutorials/change_another_field/). The completed form (https://acrobatusers.com/assets/collections/tutorials/legacy/tech_corners/javascript_corner/tips/200...  didn't seem to be completed. When tried to do it from scratch I couldn't get the Format/Custom/Keystroke Script box in the start form (https://acrobatusers.com/assets/collections/tutorials/legacy/tech_corners/javascript_corner/tips/200...)  to hold the suggested JS.

Anyway that tutorial seemed aimed at the resolution of a much  more complicated/advanced problem than I have.

 

Before, if I took the "&&(!event.value)" out of my code and the user modified the default answer, the original default answer reappeared (deleteing the modifications) when she next clicked outside the fillable box. 

 

However, I think I inadvertantly solved that problem. I moved the JS from the calculation tab/custom-calcultion-script-box to the actions-tab/Mouse-down-run-a-Java-Script. However if the user comes back to correct a modification, the form reverts to the standard default and she loses her previous modifications.

 

I think I will end up puting a button entitled something like "click for suggestions--- " above the blank to be filled in. I'll use   the following code in the button action tab:

 

if (this.getField("County").valueAsString=="056") {this.getField("Blank to be filled").value = "DEFAULT LANGUAGE for 056";}

if (this.getField("County").valueAsString=="015") {this.getField("Blank to be filled").value = "DEFAULT LANGUAGE for 056";}

 

It's not as automatic as I wanted, but it allows the user to modify the default language without running the risk of loosing her modifications. And  besides some people may  not want the suggestions of others.

 

One question that you certainly don't have to take the time to answer--- When I moved the script ( if (this.getField("County").value =="056") {event.value = "DEFAULT LANGUAGE for 056"}; ) from the calculate tab to the action tab in the same text properties window I had to repace "event.value" with "this.getField("NAME OF TEXT BOX CONTAINING THE ACTION TAB").value."  Is that required or did I miss something?

 

I probably should have originally stated that this blank  is in a form that the user wants for his own purposes. I am not collecting the information. Specifically the form is to help people with convictions expunge or clear their record. The user is most likely a lawyer or pro se litigant who will ultimately print the completed form and file it with a court.

 

 

 

I really, really, really THANK YOU for your time and expertise. I know this reply contains much more information than you want or need, but I have enjoyed thinking about this and writing down my thoughts was a good education.

 

Stay safe.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...