Hi
I have two datepickers in a form, and upon making a choice in one, I'd like
to automatically update the other (for instance, user choses a start date,
so the end date will automatically be set to start + 1 month).
Here is my OnValidate method
var date1 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:start");
var date2 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:end");
date1.nodeTypedValue = date2.nodeTypedValue;
At the 3rd line, I get an "InfoPath cannot update the data because the form
is currently read only" error and I cannot explain that error. After all,
neither start nor end have been set to be read only. Also, for some wicked
reason, if I look at date1.nodeTypedValue, or date1.text, both are empty
strings even though a value is set in the datepicker. How can I get the date
set?
Any ideas?
Stephan
Greg Collins [InfoPath MVP] - 21 Mar 2005 21:00 GMT
The form IS read-only for OnBeforeChange and for OnValidate. You must use the OnAfterChange event if you want to make changes to the DOM.

Signature
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
Hi
I have two datepickers in a form, and upon making a choice in one, I'd like
to automatically update the other (for instance, user choses a start date,
so the end date will automatically be set to start + 1 month).
Here is my OnValidate method
var date1 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:start");
var date2 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:end");
date1.nodeTypedValue = date2.nodeTypedValue;
At the 3rd line, I get an "InfoPath cannot update the data because the form
is currently read only" error and I cannot explain that error. After all,
neither start nor end have been set to be read only. Also, for some wicked
reason, if I look at date1.nodeTypedValue, or date1.text, both are empty
strings even though a value is set in the datepicker. How can I get the date
set?
Any ideas?
Stephan