Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2006

Tip: Looking for answers? Try searching our database.

getValue (VBScript)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
valendes - 19 Jan 2006 14:40 GMT
Hi

So here's my problem:

I create a new form. I add a textfield, name it "field1" and set its value
to "05"
Then i open the scripteditor using VBScript.
This is the Code I tried to use for reading the value of field1 and pass it
to the variable content (when opening the document):

-----
Sub XDocument_OnLoad(eventObj)
Set read = InfoPath.XDocument.DOM.selectSingleNode("//my:Myfields/my:field1")
content  = read.text
End Sub
-----

I also tried it with this code:

-----
Set read = InfoPath.XDocument.DOM.selectSingleNode("//my:Myfields/my:field1")
content  = read.getvalue
-----

Well, it's not working, what am I doing wrong? :)
thanks
bratt - 19 Jan 2006 15:18 GMT
The
InfoPath.XDocument.DOM.selectSingleNode("/my:myFields/my:field1").text
should work provided the myFields has the proper case.  - xpath's are
case sensitive.

You can also get it by looking for the field anywhere within the XML
path:
InfoPath.XDocument.DOM.selectSingleNode("//my:field1").text
valendes - 20 Jan 2006 08:26 GMT
> You can also get it by looking for the field anywhere within the XML path:
> InfoPath.XDocument.DOM.selectSingleNode("//my:field1").text

Thank you
I tried this one, but it's not working as well.
I checked the field name several times, and it has the proper case.
(but you're right, i wrote Myfields instead of myFields when i was using the
whole xpath)

Do i have to create any objects for reading that value or add any other code?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.