Expand my Community achievements bar.

Button presence in static PDF's

Avatar

Former Community Member

I having a heck of a time trying to figure this out and I hope I can find the answer here.

I have a form that must be static, and the autors want to include an XML submit button. However, they also want to put some kind of security on the button as they only want specific people to be able to click it.

My solution was to use kind of a poor man's password button in the form of a text field:

if (form1.Page1.TextField1 == "password") then;

    form1.Page1.xmlSubmit.presence = "visible"

elseif (form1.Page1.TextField1.rawValue <> "password") then;

    xfa.host.messageBox("Please enter Administrator password to access XML Submit");

endif

As you can see I was using the exit event of the text field to change the invisible presence of the XML submit button to visible.

From the documentation I have read, namely "Understanding the Differences Between Static and Dynamic PDF Forms" the visible/invisible presence can be used in a static form but as of yet I cannot seem to get this to work.

I am sure there is something simple I am missing, likely that I am wrong about the presence thing working in static forms.

Any help would be appreciated.

Cheers!

2 Replies

Avatar

Level 2

Your syntax looks funny to me...are you even seeing the message box if you type an incorrect value?  If not, then you have a typo.

Here are some samples that should work:

Javascript:

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

if (this.rawValue == "password")

{

    form1.Page1.xmlSubmit.presence = "visible";

}

else

{

    xfa.host.messageBox("Please enter Administrator password to access XML Submit");

}

FormCalc:

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

if (form1.Page1.TextField1 == "password") then

    form1.Page1.xmlSubmit.presence = "visible"

else

    xfa.host.messageBox("Please enter Administrator password to access XML Submit")

endif

Avatar

Former Community Member

Thanks for the reply Justin,

I was getting the message box before if I entered an incorrect value. But looking at your coding, it is cleaner than mine.

Unfortunately, still no luck. I tried your code and I still can't get the presence of the button to change. I have used the button alone set to "hidden" and/or "invisible".

I also wrapped it in a subform and set the presence of the button to visible and the subform to be "hidden" and/or "invisible", still no luck.

Is there possibly some kind of coding within a button that will not allow me to change it's presense that I am not aware of?