Hello, please bear with me this is my first post, sorry if I missed any forum rules or guidelines.
I have been working on a form which has a Text object that combines [concatenates] the values of 3 floating text fields.
That's all working OK but I should only print this combined value if "some other node" in the XML is null.
I was thinking to place a short script in the 'prePrint' of the first floating field [because Text objects seem to have no events] which will check if this other XML node is null or not. If null, it would set the 'relevant = "+print"' property of the Text object itself, else it would set 'relevant = "-print"'.
1] Is this a correct approach please?
2] Can I reference a value from the XML source data in the script? [something like "if $.node1.node2 is null"] or do I have to create some hidden/non-printing field on my form to capture the value from the XML, and then my script references the value of this hidden field?
Many thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
You are correct, the XML DOM is only accessible by binding form objects to it. You approach seems solid. It has been a long time since I've used prePrint events, but I remember them to be a bit unwieldy. If the data is static (i.e. it is part incoming XML rather than entered by the user on the form), then try to override the initialize event instead. It should accomplish the same effect.
Views
Replies
Total Likes
I've come to the conclusion that I cannot reference the XML values directly in script, so I created a hidden field which is bound to the XML element I am interested in.
But I don't seem to be able to get any kind of hiding working.
Currently I have the Text object and its floating fields wrapped in a subform, since there don't appear to be any events for a Text object.
I have tried writing in the subform's prePrint event
this.presence = "hidden";
=> it still prints
this.relevant = "-print";
=> it still prints
Does anyone have any clue why? I must have something really fundamental wrong.
Thanks in advance
Views
Replies
Total Likes
You are correct, the XML DOM is only accessible by binding form objects to it. You approach seems solid. It has been a long time since I've used prePrint events, but I remember them to be a bit unwieldy. If the data is static (i.e. it is part incoming XML rather than entered by the user on the form), then try to override the initialize event instead. It should accomplish the same effect.
Views
Replies
Total Likes
Thanks so much!
prePrint event was not working, for whatever reason.
initialize event is working.
relevant = "-print" doesn't seem to do anything but I understand this was a "relatively late" addition to PDF, perhaps the forms-renderer I have does not support it [that is somewhat out of my control].
So in summary: presence = "hidden" in the initialize event.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies