I have a scenario that I can’t find an API method for under form or dataprocessor.
There is a form, in a layout, with dataprocessor, where first the form structure from xml is being loaded:
myForm = formContainer.attachForm(); // def view
myFormDP = new dataProcessor(myFormDP);
myForm.loadStruct(myFormXML + new Date().getTime(), myFormLoadCallBack);
Then, in the callback (myFormLoadCallback), I want to load data into the form - only if there is a value assigned to a variable - before continuing to other operations.
function myFormLoadCallBack( {
// if emailRef exists in URL, load data
if (thisEmailRef != "") {
myForm.load(myFormDP+"&method=loadData&emailRef="+thisEmailRef,loadDataCallBack);
}
<snip>
}
It is working, but I’m wondering if there’s a better method to use to accomplish this. I want to always use the xml for the base structure, updating data only when necessary.
Also, unexpected was getting the ids field on the form post as “null”.
myForm.save();
Is there a way to extract the value of the “ids” form field sent on a save, so that I could send it to the myForm.load? That way I could return the xml as
<data>
<12345_affiliate>01</12345_affiliate>
<snip>
instead of:
<data>
<affiliate>01</affiliate>
<snip>
Would that work? Any ideas for me?