These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Changing Text.rawValue on Masterpage

ZieLonKa
Registered: Jun 26 2011
Posts: 5
Answered

Hi Community!
 
I'm facing the following problem:
In LSD ES2 I have a Text-Control on the master page in which I want to display a text shown on every page of my form.
The sources of the shown text are other TextField-Controls in the following layout:
 
Text1.rawValue = Text2.rawValue + " - " + Text3.rawValue;
 
I want the text on the master page to be updated in the PrePrint-Event and as I have figured out, it's possible to do this in a Button.Click-Event but not in the PrePrint-Event.
The simplified JS-code of my Text.PrePrint-Event now is:
 
this.rawValue = xfa.resolveNode("Formular1..Tbx-Ansprechpartner").rawValue;
 
Is there a way I can change the rawValue of my Text-Control on my master page in the PrePrint-Event and if there is one, how can I manage this to get working.
 
I hope you understand my problem, otherwise I'm looking forward to answering any further questions regarding this.
 
Greetings,
ZieLonKa

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you can do this also with the prePrint:event.
All you need is a loop.
This is neccessary if your master page is present on several pages.

  1. for (var i = 0; i < xfa.resolveNodes("Masterseite[*]").length; i++)
  2. {
  3. var mp = "Formular1.#pageSet.Masterseite[" + i + "]";
  4. var mpSOM = xfa.resolveNode(mp);
  5. mpSOM.Text1.rawValue = xfa.resolveNode("Formular1..Tbx-Ansprechpartner").rawValue;
  6. }

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ZieLonKa
Registered: Jun 26 2011
Posts: 5
Hi again,

I did as you told me, anyway it does not work.
Maybe I misunderstood the syntax of your script, so here is mine as reference:

  1. for(var i = 0; i < xfa.resolveNodes("Master.Seite1[*]").length; i++)
  2. {
  3. var mp = "Formular1.#pageSet.Master.Seite1[" + i + "]";
  4. var mpSOM = xfa.resolveNode(mp);
  5. mpSOM.Tbx-VSNrLabel.rawValue = xfa.resolveNode("Seite1.Versicherungsnummer.Tbx-Versicherungsnummer").rawValue + " - " +
  6. xfa.resolveNode("Seite1.AngabenVersichertePerson.Tbx-VP-Vorname").rawValue + " " +
  7. xfa.resolveNode("Seite1.AngabenVersichertePerson.Tbx-VP-Name").rawValue;
  8. }
A screenshot of my hierarchy can be found at
http://imageshack.us/photo/my-images/233/hierarchyf.png/

Thanks in advance,
ZieLonKa
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you cannot use the hyphen (-) in your object names, as this character is reserved for scripting.
Use an underscore (_) instead!

  1. var ppValue = xfa.resolveNode("Formular1.Seite1.Versicherungsnummer.Tbx_Versicherungsnummer").rawValue;
  2. ppValue += xfa.resolveNode("Formular1.Seite1.AngabenVersichertePerson.Tbx_VP_Name").rawValue;
  3. ppValue += xfa.resolveNode("Formular1.Seite1.AngabenVersichertePerson.Tbx_VP_Vorname").rawValue;
  4.  
  5. for (var i = 0; i < xfa.resolveNodes("Master.Seite1[*]").length; i++)
  6. {
  7. var mp = "Formular1.#pageSet.Seite1[" + i + "]";
  8. var mpSOM = xfa.resolveNode(mp);
  9. mpSOM.Tbx_VSNrLabel.rawValue = ppValue;
  10. }

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ZieLonKa
Registered: Jun 26 2011
Posts: 5
This code seems to work better than mine, but still no effect.
I neither can assign a static value to the master page's Text-control... so
  1. mpSOM.Tbx_VSNrLabel.rawValue = "test";

won't work.

Any suggestions?
Do you need more information to help me?

greetz
ZieLonKa
padobe
Registered: Jun 29 2011
Posts: 10
Accepted Answer
Please try making master page field as Global by going to the binding tab and select Use global data under Data Binding tab.
ZieLonKa
Registered: Jun 26 2011
Posts: 5
Great!

Now it works flawlessly.
Much thanks, you both helped me a lot ;)

ZieLonKa
raZorTT
Registered: Jun 29 2011
Posts: 3
padobe wrote:
Please try making master page field as Global by going to the binding tab and select Use global data under Data Binding tab.
Are you able to explain this further? When I select the field on the masterpage I don't get a binding tab.

I am having a problem where a simple test form I have set up works fine. I can loop over the text fields in my master pages and change the value.

However when I copy the code into a more complicated form that I have been working on nothing happens.

Cheers,
Simon

ZieLonKa
Registered: Jun 26 2011
Posts: 5
Hi raZorTT,

at the following link you can see a screenshot of my settings, where I changed the global binding.

http://imageshack.us/photo/my-images/94/globalkp.png/

I know, it's in german, but I think it may help you anyway.

padobe
Registered: Jun 29 2011
Posts: 10
Hi,

Please select the field from hierarchy and goto windows tab->object library->binding tab->data binding(open,save,submit)click on the arrow and select use global data.Regards,
raZorTT
Registered: Jun 29 2011
Posts: 3
Thanks guys,

It turned out not to be a binding issue but a script I was calling in a calculate function. I removed the script and was able to change the field.

Now the problem is I can change the text field, but as soon as I click on something else it reverts back to what it was previously.

Any thoughts?

Cheers,
Simon

raZorTT
Registered: Jun 29 2011
Posts: 3
I fixed my problem by binding the text field in my masterpage to a hidden field in my form using global bindings.

Thanks for the help!

Cheers,
Simon