Retrieving textbox value

T

tammy.djuric

I've set up an Infopath form which uses a relational Access database as
the main datasource and an SQL Server database as the secondary
datasource. I'm using the value of one textbox in the form to filter
information from the secondary database. I've been able to get this
working in a dummy form which only has the secondary database using

var objEmpId;
objEmpId =
XDocument.DOM.selectSingleNode("//my:myFields/my:txtEmpId").text;

I've tried to get this working on my other form but can't get the value
from the texbox. I've been testing using a message box but the closest
I can come is having the message box appear (I was getting errors
before I got to this stage) but it's blank. I have another message box
which displays the SQL statement being passed to the database and the
field comes up as undefined.

The code I have is
var objEmpId;

objEmpId =
XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:tbl_Employee/@UserCode").Text

Any help will be greatly appreciated!
 
S

S.Y.M. Wong-A-Ton

JScript is case-sensitive. Try .text instead of .Text

Correct code snippet:

objEmpId =
XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:tbl_Employee/@UserCode").text // <- correction!
 
T

Tammy

That did it!! Thank you so much - I can't believe I spent so much time
on it and it was that simple!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top