Expand my Community achievements bar.

how to take object from hidden to visible (screen only)

Avatar

Level 3

how do I take an object from hidden to visible (screen only) is there code for this?

3 Replies

Avatar

Former Community Member

You have to set the presence property. For example,

form1.page1.subform1.name.presence = "hidden";

form1.page1.subform1.name.presence = "visible";

If you have a form with a text field called 'name' and a button called 'visibilityBtn' with a caption of 'Hide', you could attach the following script to the click event of the button to toggle the visibility of the text field from visible to hidden.

// form1.page1.subform1.visibilityBtn::click - (JavaScript, client)

var status = xfa.resolveNode("form1.page1.subform1.visibilityBtn.caption.value.#text").value;

if (status == "Hide") {

  form1.page1.subform1.name.presence = "hidden";

  xfa.resolveNode("form1.page1.subform1.visibilityBtn.caption.value.#text").value = "Show";

}

else {

  form1.page1.subform1.name.presence = "visible";

  xfa.resolveNode("form1.page1.subform1.visibilityBtn.caption.value.#text").value = "Hide";

}

Note - the most common mistake when it comes to dynamic form behaviour is to forget to save the form as a dynamic PDF form.

Steve

Avatar

Level 3

Steve,

I see what your saying but I need to make it screen only visible so it will not print,

So would that be form1.page1.subform1.name.presence = "print";?

Avatar

Former Community Member

Sorry. Try setting the relevant property on the applicable objects to "-print" on the prePrint event. For example,

// form1.page1.subform1.table_.row_[0].date::prePrint - (JavaScript, client)

this.relevant = "-print";