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

Javascript Custom Calculation Script generates populated data, but won't let you input your own text.

New Here ,
Aug 25, 2017 Aug 25, 2017

I've created a numerous amount of check boxes to populate a sentance in one main text area. I have this basic code used under Custom Calculation Script:

------------------------------------------------------------------------

var a =""

if (this.getField("sample text").value =="Yes")

{

a=a + "R - sample text.  "

}

event.value=a

------------------------------------------------------------------------

When i go to the main text area that contains that code and i click in it...i see the populated sentance i wanted, but what i want is to add more text to it....when i try to type in..it shows up fine, but when i click out of the text area, it disappears...i need it to stay.

please help.

TOPICS
Acrobat SDK and JavaScript
641
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

correct answers 1 Correct answer

Community Expert , Aug 25, 2017 Aug 25, 2017

Then use this code as the Mouse Up script of the check-box, and remove the one you have as that field's calculation script:

if (event.target.value!="Off") this.getField("Service Summary").value = "R - sample text.  ";

Translate
Community Expert ,
Aug 25, 2017 Aug 25, 2017

That's tricky... You need to tell the script to only apply the automatic calculation if the source fields are changed, but that will overwrite any values you manually entered to it.

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
New Here ,
Aug 25, 2017 Aug 25, 2017

well see this form is being used as a mechanic check list...meaning....there are 2 check boxes per line....

one check box generates the "R - with description". R meaning Repair

another check box generates the "U- description". U meaning Unsafe

the idea behind it is....the mechanic clicks R (checkbox) or the U checkbox....and that sentence populates in the text area below, to which  he writes in addition to that generated sentence, and describes what kind of repairs or why its unsafe. But the entire text including the populated one disappears when clicked away from that box.

not sure if this helped pinpoint my exact problem?

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 ,
Aug 25, 2017 Aug 25, 2017

What is the name of the text field?

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
New Here ,
Aug 25, 2017 Aug 25, 2017

Service Summary

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 ,
Aug 25, 2017 Aug 25, 2017

Then use this code as the Mouse Up script of the check-box, and remove the one you have as that field's calculation script:

if (event.target.value!="Off") this.getField("Service Summary").value = "R - sample text.  ";

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
New Here ,
Aug 25, 2017 Aug 25, 2017
LATEST

Ooof.....i see.

problem there is..this document has 73 lines of check boxes...2 check boxes per line

so i'd have to do that for every single one...hmm....

Okay, i think i can live with doing this fix tho...

make 2 text areas....exactly the same..one with just the code and another with a regular text input.....so basically the text area where the populated text appears i will Ctrl+A Copy and paste to the second therefore allowing me to edit, and add extra comments.

Thank you for the code, i do appreciate your help..i will try that option in the future when another form is needed...it would save me then by doing an extra step.

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