Skip to main content
Participant
August 25, 2017
Answered

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

  • August 25, 2017
  • 1 reply
  • 729 views

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.

This topic has been closed for replies.
Correct answer try67

Service Summary


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.  ";

1 reply

try67
Community Expert
Community Expert
August 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.

Participant
August 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?

try67
Community Expert
Community Expert
August 25, 2017

What is the name of the text field?