Expand my Community achievements bar.

SOLVED

If statement, when true, runs two actions

Avatar

Level 9

How do I write an if statement that when true, runs two actions?

 

if (NumericField1.rawValue > 0)

{

    xfa.resolveNode("#pageSet.Page1.Image1").presence = "visible" + Rectangle1.presence = "visible";

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Well, the problem is you're trying to control objects on the body page and a masterpage at once.

This is generally not so simple to accomplish.

I changed your form a bit.

The paperclip image and the numeric field now monitor the valur of the numeric field and change the wanted property if the value is larger than 0.

Script for the paperclip (wrapped in a subform)

Script for the numeric field

Script for the remove button

https://acrobat.com/#d=55A3x-8Zm7D29eK7*brqxQ

View solution in original post

6 Replies

Avatar

Level 10

Generally all actions should be written in a separate code line:

if (NumericField1.rawValue > 0) {

    xfa.resolveNode("Image1").presence = "visible";

    xfa.resolveNode("Rectangle1").presence = "visible";

}

Avatar

Level 9

Still does not work. I must be doing something wrong. Form is linked below...

https://acrobat.com/#d=M9EvNlO*0XvduxOVaoZ-Qg

Avatar

Level 9

Two things are supposed to happen whe nthere are more than one or more attachments.

The yellow rectangle becomes visible and the "paperclip" appears at the top of the form (on master page).

Avatar

Correct answer by
Level 10

Well, the problem is you're trying to control objects on the body page and a masterpage at once.

This is generally not so simple to accomplish.

I changed your form a bit.

The paperclip image and the numeric field now monitor the valur of the numeric field and change the wanted property if the value is larger than 0.

Script for the paperclip (wrapped in a subform)

Script for the numeric field

Script for the remove button

https://acrobat.com/#d=55A3x-8Zm7D29eK7*brqxQ

Avatar

Level 9

radzmar:

Now that I see the correct answer I know I never would have figured this out. Your form works great! This is why I was trying to close the pane that contains the paperclip so users would only use this interface. Thank you so much for all your help with this. I really appreciate your time and sharing your expertise.

Have a great day!

-Don