Checkbox won't start as "invisible"

Albinorizer

03-12-2017

Hi Everyone,

I'm new to the forums so if I've posted this in the wrong location, I apologize.

I'm working on an interactive pdf and I need a bunch of check boxes to show as being "visible" or "invisible" depending on what has been typed into a text field.  I'm able to get that to work, however I can't seem to get the check boxes to start off invisible.  If I manually change the presence of the object to "invisible" my code stops working and the checkbox stays invisible all the time.  Below is my coding.

This is coded in the "click" function of a button.  I've tried it on my main page under the "calculation" event.  The coding works the same but makes no difference to the starting presence of the check box.

if (adminpass == "") then

occ1.presence = "invisible"

elseif (adminpass == "123") then

occ1.presence = "visible"

elseif (adminpass == "off") then

occ1.presence = "invisible"

elseif (adminpass == "0") then

occ1.presence = "invisible"

endif

What each thing is.

adminpass:  This is a text field for the user to input a password (password is 123 for the time being)

occ1:  This is a check box that interacts with other aspects of the pdf.  There will eventually be a total of 60 checkboxes.

I've imported artwork and have created forms and things over top of this artwork.  As I understand it, there are limitations when you import artwork.  If there is any other info required of me, please let me know.  Any assistance would be greatly appreciated.  Thanks in advance!

Jared

Accepted Solutions (1)

Accepted Solutions (1)

Thom_Parker

03-12-2017

I prefer JavaScirpt because it is useful in many other places. That and LiveCycle is dead.

Were there any  error messages when you ran this code?

You should concentrate only on the Visible case, cause anything else is invisible.

if (adminPass == "123") then

  occ1.pesence = "visible"

else

  occ1.pesence = "invisible"

endif

Answers (6)

Answers (6)

Albinorizer

03-12-2017

When I set the check box presence to "invisible" in LC Designer, then I open the PDF the check box is in fact invisible, however the code will not change it's presence to "visible".

I've used your suggested code within the button to make everything work as it should.  The only issue is that the check boxes are visible when the pdf is opened.  I have figured out a workaround to the boxes being visible.  I just open the pdf, click on the button with no password in place in order to make the boxes go away and then re-save the pdf.  This causes the next open to not display any check boxes.

I'm sure this whole process would be significantly easier with JavaScript however that is out of my realm of skills.  Thanks again for your Help Thom.  Very much appreciated!

Jared

Thom_Parker

03-12-2017

The code I posted for the button click has nothing to do with making the check box invisible when the PDF is opened, it is only intended for the button. The visibility on open is a completely different issue.

If you set the check box presence to "invisible"  in LC Designer, then you open the PDF and the check box is visible, then there is code in the PDF that is setting it. The button click script is only run when the user clicks on the button, not on open.  I would suggest deleting all references to this check box in all code that is run on document open.

Albinorizer

03-12-2017

Thanks Thom.

That code does make the checkbox invisible when the pdf is opened, however when "123" is typed into the text field, the checkbox does not show up.

No errors showed up with the previous code or this code.  The checkbox seems to hold the presence of invisible no matter what now.

Jared

EDIT:  This code works within a "click" event on a button, however the checkbox stays visible until the button is pressed (with no text in the text field).  Then the 123 password works as it should.  I'm aiming to have the checkbox invisible when the pdf is opened and to stay invisible until a user enters the appropriate password.

With this code in in my "calculation" even on the main page, the checkbox is "invisible" when the pdf is opened (as it should be), but then the password does not make the box show up when put into the text field. 

Albinorizer

03-12-2017

You are correct Thom. I'm using livecycle.

Formcalc would be preferred as I understand it much more than I do JavaScript. However if the problem can't be resolved with formcalc then ill have no choice.

Thanks for your quick response as well!

Jared