Expand my Community achievements bar.

formcalc syntax working as javascript...How can that work?

Avatar

Former Community Member

I've been chasing some problems with a forms project I've been working on and just noticed something odd as I was reseearching and reading anything I can find on the web in relation to interactive forms.

I have a dropdown list field that drives the presence of various checklists depending on which item is selected by the user.

In reading a post by Stefan Cameron online regarding the bounditem function I noticed sample syntax for both Java and formcalc.

I have the same format mentioned for formcalc but the language is set to Javascript in the script editor window and the field is working exactly as I need it to when I preview the form or work with it in Adobe or Reader up until when I save the completed form in reader.

At that point, parts of my form refuse to remain visible.

My first question is how is the formcalc syntax of my script working at all when language is set to Javascript?  If I change it to formcalc....my field shows an error message when I select an item in preview.

sample:

 

AcctOpenProcesssubform.CSSystemSetupForm.Account_Client_Info.CHOOSE_ACCOUNT_TYPE_HERE::change - (JavaScript, client)

$.resolveNode("T174").presence = "invisible";

if ($.boundItem(xfa.event.newText) == "42 - Irrevocable Marital Trust" || $.boundItem(xfa.event.newText) == "42 - Irrevocable Residual Trust" || $.boundItem(xfa.event.newText) == "42 - Irrevocable Trust U/A") {

  this.resolveNode("IrrevTrust").presence = "visible";

}

else {

  this.resolveNode("IrrevTrust").presence = "hidden";

  xfa.layout.relayout();

}

I cant recall but when I started this project, I think I used the action builder to get the page to become visible or stay hidden. Then I copied the code and edited as necessary for my other scenarios so now I have similar code hiding/showing about 12 different checklists.

Next question is could this cause the problems I'm seeing when I save the form as a reader extended pdf? Specifically, when openning a saved form, the pages that were visible when saved, are hidden when reopened.

Is it better to leave it alone since it appears it is working or edit the code in the Java syntax (this.bounditem...etc)?

1 Reply

Avatar

Level 10

Hi,

the XFA specs describes why the $. expression also work in JavaScript.