These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Removing "Off" from export values in another field

Anonymous
Answered

I have this simple script that i found below that works well. It combines the 3 check boxes "1a" "1b" and "1c" together into one field. I have entered this script in the new field that I wish the text to be collated in. The only problem i have is that i would really like it so that none of the fields would display the word "off" if the check box was not selected!

This is my script...
event.value = this.getField("1a").value + " " + this.getField("1b").value + " " + this.getField("1c").value;

I also found this code in the forums, this does it perfectly, but only for field "1a" and i can not replicate the script so that it works for all of them.
event.value = this.getField("1a").value; if (event.value == "Off") event.value = '';

If anybody could help me finisg the script it would be greatly appreciated,

Thankyou

My Product Information:
Acrobat Pro 9.1.1, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You only need to add some 'if' statements to test the value of each field and if the value of the field is 'Off' you would insert a null value.

// get the values of the check boxesvar c1a = this.getField("1a").value;var c1b = this.getField("1b").valuevar c1c = this.getField("1c").value// if any check box has a value of 'Off' null the valueif(c1a == 'Off') c1a = ''; // null value 1a if it is 'Off'if(c1b == 'Off') c1b = ''; // null value 1b if it is 'Off'if(c1c == 'Off') c1c = ''; // null value 1c if it is 'Off'// set the field valueevent.value = c1a + " " + c1b + " " + c1c;

George Kaiser

smitchell15 (not verified)
Your a genius! Thankyou very much! Spent most of the afternoon trying to work that out!

Thank you again for the very quick reply

Cheers