Script Error "Object Required"

J

Janie

I have a save event scripted, but I'm getting an error message when I try to
save the form that says "Object Required. File: script.js Line 212"

Here's the section where line 212 occurs - line 212 begins with
"DisplayAccountability.text":

else if (Disp2.text == "")
{
DisplayActionItem.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:ActionItem2").text
DisplayAccountability.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:Accountability2").text
DisplayDueDate.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:DueDate2").text
DisplayCompleteDate.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:CompleteDate2").text
DisplayHowComplete.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:HowComplete2").text
DisplayNotes.text =
XDocument.DOM.selectSingleNode("//my:myFields/my:Note2").text

What's going on? The rule is designed so that when one "task" is completed,
the next task due is the one to display.
 
F

Franck Dauché

Hi Janie,

Your XPath should start by /my:myFields, not //my:myFields.

Regards,

Franck Dauché
 
J

Janie

Not sure if my previous message got to you. I changed all of the instances,
but I'm getting the same error.
 
F

Franck Dauché

Try 1 line at a time. But I am not sure what you are trying to do here.

To access one node, use:
var node = XDocument.DOM.selectSingleNode("/my:myFields/my:ActionItem2");

Note that you are missing the final ";"

You can use XDocument.UI.Alert(node.text); to check that the node exists and
has a value.

Next you can assign that value to a var:
var temp = node.text;

Hope that it helps.

Franck
 
J

Janie

Frank, is there any way to send an attachment of my code to these replies?
Should there be a semicolon after every var line?
 
F

Franck Dauché

Nope, but you can send me an email..

Franck

Janie said:
Frank, is there any way to send an attachment of my code to these replies?
Should there be a semicolon after every var line?
 

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