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

How to bind data from script created variable to embed element of XML SCHEMA (xsd) in "Data View"

bartosh44
Registered: Dec 18 2010
Posts: 8
Answered

Hi, i have got another problem with livecycle designer scripting.
 
I have got script line which is defining of string variable:
 
var aaa = "this is my string";
 
and i have got embed XML schema like this (it`s only short part of whole file):
 
... xs:element name="bbb" type="xs:string"/ ...
 

After saving data to XML i would like to get "this is my string" as a value of my "bbb" XML element.
 
To save this data i`m using submit button which is connect with submit.php file on my server.
 
How to connect script created variable and embed XML schema element which is present on my "Data View" tab.
 
Please help me a bit becouse i don`t know even where to search answer of it...
 
Of course i know possibilities to create fake unvisible text field object and bind it with 'bbb' and than put "this.rawValue = aaa" to connect those two variables but i think that is not a good idea to solve it in that way. It`s too primitive ;)

My Product Information:
LiveCycle Designer, Windows
bartosh44
Registered: Dec 18 2010
Posts: 8
Accepted Answer
i solve it, i should write this:
xfa.datasets.data.bbb.value = aaa;
Masi
Registered: Sep 18 2008
Posts: 22
Why scripting is better in your opinion? If you get a form made by someone else and should find out, where some data element gets its value, wouldn't it be easier to find the bound element rather than the script? Depending of course if there are only that single script or if there are tens or hundreds of lines of scripts.

Just wondering what is "the best practice" if there are any..
bartosh44
Registered: Dec 18 2010
Posts: 8
Hi, in my opinion your question is like: "What was first: the chicken or the egg?" ;)

It`s hard to answer that becouse anything what i would say, will be attacked by opposite side :)

I prefer script way in most of cases becouse of easy dynamic create, modify and erase of that. Second reason is that clear few lines of script are better than hidden objects on the scene - in my opinion of course.

But true is also that one way without the second one is nothing. So if you want scripting without objects you have C++, java, etc.

The best practice for me it`s not to being addicted to neither of sides... but i`m green in Livecycle and it`s only my opinion so everyone may disagree with that;)