How to capture datevalue?

G

G.N.Rajesh

Hi all,

We are trying to capture the date value of a datepicker control which is
placed on an Infopath form into a variable through javascript.
We are not able to capture the value.

we are using the method like:

var datevalue = XDocument.DOM.SelectsingleNode(..path). text;

it is showing javascript error.

Could you please help us on this?

:D

Rajesh
 
S

Scott L. Heim [MSFT]

Hi,

Here is sample jscript code that works in a sample where I simply placed
the Date Picker control on a new, blank form:

function CTRL2_5::OnClick(eventObj)
{
var myDateVal = "";
var myDate = XDocument.DOM.selectSingleNode("//my:myFields/my:field1");
myDateVal = myDate.text;
XDocument.UI.Alert(myDateVal);
}

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

G.N.Rajesh

Hi Scott,

This coding is working fine when i placed date picker out of repeting
table.But my requirment is i should capture a date picker value from repeting
table. when i placed the date picker inside the repeting table it shows error
message like this

"Object Required"

you have any suggestion for this.
 
S

Scott L. Heim [MSFT]

Hi Rajesh,

That information helps - the problem you are running into is determining
exactly what row you want to return. Do you have the ability to add another
column in the repeating table and place a button in that column? In this
manner, each row would have an associated button and you could easily get
the value of the row you are on by using code like the following:

function CTRL5_5::OnClick(eventObj)
{
var dateVal = eventObj.Source.selectSingleNode("my:field1").text;
XDocument.UI.Alert(dateVal);
}

In this case, my "field1" is the Date Picker control in the first column of
my repeating table.

Let us know if this is a viable solution!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Martyn Lawson

Hi,

Thanks for this post it saved me a lot of trouble. However, i now have more
trouble. Using the solution below only appears to find the date value from
the first row in the repeating table. How do i find subsequent rows in the
code?

Cheers,
Martyn...
 

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