Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Script to set presence of a subform based on a field's value not working

Avatar

Level 3

I am setting up a type of evaluation form that needs to have a subform appear at the bottom whenever the evaluation fails. The subform contains text that will describe what the person will need to do for failing the evaluation.

Right now, I have the form set up to run a script whenever the "pass/fail" box changes. The script looks for the value of the pass/fail box and sets the presence of the end subform to visible if the pass/fail box text says "Fail".

For some reason though, the script is not reading the value of the pass/fail box. I can't figure out where I am going wrong.

Can send the form to whoever wants to take a quick look at it. Trying to find a way to make it available online...

- Using LiveCycle Designer ES v8.2.1...

6 Replies

Avatar

Level 2

In your Switch stament you are referencing the subform as:

MAINBODYSUB.MainSub.FailedInspSub.presence = "visible";

Looks like you may need to precede it with form1 based on the hierachy:

form1.MAINBODYSUB.MainSub.FailedInspSub.presence

Avatar

Level 3

I tried it again using form1, but it didn't work.

When using the form, enter in a "1" into the first box under "Code." This will turn the Pass/Fail result to "Fail". This should prompt the subform to appear, but it doesn't.

Avatar

Level 2

I commented out your switch statement in the function and tested with the following which dispalyed the subform:

form1.MAINBODYSUB.MainSub.FailedInspSub.presence = result == "Fail" ? "visible":"hidden";

Avatar

Level 3

Doesn't work consistently.

Here is the file modified with your script:

https://www.box.com/s/09dzlu2kmiv7uziqef7j

The way it should work is that, when you enter in a code, such as 1, a type appears on the right hand side- either C or S. A C is an automatic Fail and should appear in the pass/fail box after entering in the 1 under the code column. After the Fail appears, the script should be called and the subform should appear.

Then, if you were to change the 1 under the code to a 6, the resulting type is an S which makes the pass/fail box turn to Pass. At this point, the subform should disappear.

Does that make sense?

Avatar

Level 2

Try commenting out failCheck.boxView() on the scoreVal calculate event and

add it to the DebitVal calculate event.

DebitVal::calculate - (JavaScript, client)

failCheck.boxView();

That should work but will make the type field protected.