Skip to main content
Princeplanet
Inspiring
September 6, 2022
Answered

use of event.value = this.getField("Text").value; and custom text

  • September 6, 2022
  • 1 reply
  • 4527 views

I'm using Acrobat Pro 2017

I'm making a simple form for use at funerals. no big deal there.

 

I have a field called "1st Reading", which is a drop down. So the choices are OT-1, OT-2, OT-3, etc. Each of these has an export value of a Scripture verse that will be used. I also have as one of the choices OTHER, with no export Value. In the options tab, I also have checked allow user to enter custom text.

 

I have another field called "OT Reading" that uses "event.value = this.getField("1st Reading").value;" as a custom calculation script. It pulls the export value  from the "1st Reading" and fills in the blank fine.

 

My question. Is there a way to allow custom text when "OTHER" is selected from the drop down menu. The other values (OT-1, OT-2, etc.) would stay the same.  Families may want to use a Scripture verse that is not listed as an option. ATM, when I type in a scripture value, it just erases. If I type in, let's say "custom" in the "1st Reading" field, it just returns "custom" in the "OT Reading" field

 

Thanks for your help.

This topic has been closed for replies.
Correct answer Nesa Nurani

As 'Validation' script of dropdown field ("1st Reading") use this:

var f = "";
for(var i=0; i<event.target.numItems; i++){
if(event.target.getItemAt(i, false)==event.value){
f = event.target.getItemAt(i, true);}}
this.getField("OT Reading").value = f;

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
September 6, 2022

As 'Validation' script of dropdown field ("1st Reading") use this:

var f = "";
for(var i=0; i<event.target.numItems; i++){
if(event.target.getItemAt(i, false)==event.value){
f = event.target.getItemAt(i, true);}}
this.getField("OT Reading").value = f;

Princeplanet
Inspiring
September 6, 2022

Thank you so much for your response!

However, it's not working. When I choose "OTHER" the fill in for OT Reading is "OTHER." When I went to type in a custom text, it just reverted to "OTHER."

Would seeing the file help? There isn't any private info to it.

 

https://drive.google.com/file/d/16Ukh89ce4UVbs2cWHG53DLXcFUIVWC3B/view?usp=sharing

Princeplanet
Inspiring
September 6, 2022

Remove script from "OT Reading" field.


Works! Thank You!