It's a simple question... How can I set the date of a date picker field?
This doesn't works:
_doc.DOM.selectSingleNode("/my:myFields/my:MyDatePicker").nodeValue =
DateTime.Now.ToString("yyyy-mm-ddThh:mm:ss");
and this also:
_doc.DOM.selectSingleNode("/my:myFields/my:MyDatePicker").text =
DateTime.Now.ToString("yyyy-mm-ddThh:mm:ss");
I've tried a lot of other values, but nothing functions. I need to set a
date "one year ago", for example: Today()-365!
Thank you for replies...
Martin Cabalzar
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm
--
"Martin Cabalzar" <m.cab...@gmx.ch> wrote in message
news:%23$rcgo$CEHA...@tk2msftngp13.phx.gbl...
If you want to set a default date value in the Date Picker Control you can
do this by:
1. In design mode, add a "Date Picker" Control
2. Right Click on the control and open the "Date Picker Properties" dialog.
3. Within the Properties dialog, click on the "Data" tab and specify a
default value on the "Default Value" text field.
If you want to specify today's date as the default value, for example, click
on the "Formula" icon and type "today()".
hope this helps,
- josé
Jose Oliver-Didier
Software Test Engineer
Microsoft Office InfoPath
Check out http://blogs.msdn.com/infopath for additional InfoPath tips and
tricks.
Please post questions to the newsgroup; everyone benefits.
This posting is provided "AS IS" with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm
"Martin Cabalzar" <m.cab...@gmx.ch> wrote in message
news:%23$rcgo$CEHA...@tk2msftngp13.phx.gbl...
Where did you put the code snippet below for setting the date? In the
OnLoad handler?
The data type of a date picker by default, is date. Did you change it to
dateTime?
The date picker field is blank by default. Did you remove the xsi:nil
attribute from the field before setting it?
One more thing, you probably want "yyyy-MM-ddThh:mm:ss" so that you get
months instead of minutes in the format string.
Gary
"Martin Cabalzar" <m.cab...@gmx.ch> wrote in message
news:%23$rcgo$CEHA...@tk2msftngp13.phx.gbl...
"David Fries [MSFT]" <davf...@online.microsoft.com> wrote in message
news:Opb8$5EDEH...@tk2msftngp13.phx.gbl...
I've tried various date formats... the problem is still the same: I can't
access the date picker field programmatically. I can set the text of the
picker to a date, but there's always a dashed border around the box!
I don't receive an error message - it's just the dashed red border around
the box... I also tried formats like mm/dd/yyyy and so on, but it's still
the same problem.
Martin
P.S. The functions in the formula editor are very basic. I've to calculate
with dates and times - I cannot use the function today() only!
"Gary Hsu [MSFT]" <gar...@online.microsoft.com> wrote in message
news:udgq1KFD...@TK2MSFTNGP11.phx.gbl...
If the data type is "Date (date)", then the value of the field must be in
the form of "yyyy-MM-dd" in order for the date picker field to not have a
red dashed border around it. The red dashed border indicates that the field
has a validation error.
If the data type is "Date and Time (dateTime)", then the value must be in
the form of "yyyy-MM-ddThh:mm:ss".
I suspect you still have the data type set as "Date (date)". So if you set
the text of the field programmatically to "yyyy-MM-ddThh:mm:ss" format, it
will show the red dashed border.
You either change the data type to "Date and Time (dateTime)" or set the
field's text value to "yyyy-MM-dd" format.
Gary
"Martin Cabalzar" <m.cab...@gmx.ch> wrote in message
news:%2388AJXM...@TK2MSFTNGP11.phx.gbl...
Martin Cabalzar
"Gary Hsu [MSFT]" <gar...@online.microsoft.com> wrote in message
news:%23Y2BGTR...@TK2MSFTNGP09.phx.gbl...