Write field form from VB

I have a pdf created with Adobe LiveCycle, and i want to write a value into a field form from vb macro.

I have read this code doesn’t work with XFA forms:
jso.getField("Formulario1.form.ens").value = "myValue"

so i have replaced it by this, but doesn’t work:
jso.xfa.resolveNode("jso.xfa.Formulario1.form.ens").rawvalue = "myValue "
or
jso.xfa.Formulario1.form.ens.rawvalue = "myValue "

Which would be the correct syntax if the field in LiveCycle is called “Formulario1.form.ens”

Thanks


Ismael Guerrero


5 Answers

Voted Best Answer

This is a snippet from a sample application that is working for me - it first reads the value from "TextField1", displays it, then modifies the field and displays the value again. Because you are using resolveNode of the jso.xfa element, you can skip the jso.xfa and start your string with "Formulario.form` - does that work?

Dim xfa As Object
Set xfa = jso.xfa.resolveNode("form.form1.subform1.TextField1")
MsgBox (xfa.rawValue)
xfa.rawValue = "123"
MsgBox (jso.xfa.resolveNode("form.form1.subform1.TextField1").rawValue)

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


By Karl Heinz Kremer   

I'm not an expert on LCD forms, but I do know that the name of this property is rawValue, not rawvalue...

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


Gilad D (try67)   


Sorry, i have 'rawValue' in my VB code.


Ismael Guerrero   

Depending on how your XFA form was created, this might, or might not work. Is this a form you've created, your chances of getting this to work are much better than if you would be using e.g. a government created document.

As to Gilad's comment: VB/VBA will change the case of your variable names, so you may be typing "rawValue", but after VB reformats it, you might be ending up with "rawvalue". This is usually not a problem, the JSO bridge is smart enough to deal with that.

Both styles should work - what is happening with your form? Are you getting errors in VB?

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   

The form is created by me with Adobe LiveCycle Designer 8.2.


The problem is that i can’t get to change the value of the field, returns the following errors:

jso.xfa.resolveNode("jso.xfa.Formulario1.form.ens").rawValue = " myValue " -> returns error 424
jso.xfa.Formulario1.Form.ens.rawValue = "myValue " -> returns error 438


Thanks


Ismael Guerrero   


Please specify a reason: