Jscript syntax for accessing the value of a field in a form

H

Henry Ong

Hi all, I've been slaving over this for quite a while.

Scenario: I have a form connected to a Data Source(sql server).

Problem: I can't seem to get any values returned from the fields via Jscript.

Not sure if I'm correctly accessing the fields but here's my code:

function
msoxd__Facilities_PurchaseOrderForm_Quantity1_attr::OnAfterChange(eventObj)
{

var quantity =
("//dfs:myFields/dfs:dataFields/d:Facilities_PurchaseOrderForm/@Quantity1").text;

XDocument.UI.Alert(quantity);
}

I'm not getting any data output to the alert. Any ideas? And thank you in
advance!
 
S

S.Y.M. Wong-A-Ton

I'm missing a reference to the Main DOM. You are just listing an XPath
expression here in your code.

Try this:
var quantity =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Facilities_PurchaseOrderForm/@Quantity1").text;
 

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