Hi
I'm, you have guessed, a newB.
In my template, I've a field with the current date by default (the function
in English should be something like Today(), in French it's auj()). This
field can be changed after by the user.
I would like another field (next to the first one) to have the date today +
3 months. This field should be editable by the user.
Could you help me doing it ?
FYI, I just have Infopath of the Office 2003 SP1 pack, I don't have Visual
Studio and the like.
Thanks in advance
Kind regards
ZedroS
suresh Reddy - 02 Feb 2006 06:00 GMT
Hi Zedros,
Try out this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvid/html/msdn
_vidateadd.asp.
Hope this Help you.
Thank u.

Signature
suresh Reddy
www.autonomysystems.com.
> Hi
>
[quoted text clipped - 16 lines]
> Kind regards
> ZedroS
ZedroS - 02 Feb 2006 08:20 GMT
Hi Reddy
Thanks for your answer.
In fact, my problem is more to manage to input this value as the default
value of my field. Indeed, I've the choice between :
- insert a field or a group
- insert a function -> only the default functions are offered, I don't
manage to insert a "developper's made" one
Do you have a clue ?
Thanks again
Best regards,
ZedroS
> Hi Zedros,
>
[quoted text clipped - 25 lines]
> > Kind regards
> > ZedroS
Sandeep - 02 Feb 2006 13:05 GMT
Hi ZedroS
This code writen in JScript language.
Expl:
Month started to 0
0 is jan so here setMonth(5) means May.
("/my:myFields/my:field2") Here write your field Xpath.
........
Past this code to OnLoad Function.
dtNextMonth = new Date();
dtNextMonth.setMonth(5);
XDocument.DOM.selectSingleNode("/my:myFields/my:field2").text = dtNextMonth;
I Hope this will Help U.

Signature
Sandeep
www.autonomysystems.com
ZedroS - 03 Feb 2006 12:45 GMT
Hi Sandeep
Sorry for the delay, I had other stuff to do (and I still do, but you know
;)).
First of all, thanks for your help. It's definitely helping me a lot.
However, I've run in another, the field where I would like to put a default
value is named toDatePresentation. The path in my DOM is
/test:news/test:toDatePresentation.
Furthermore, the field in question is in a section which is visible only if
a link is clicked on before.
So I've put your code but it does nothing on startup.
Thanks in advance
Cheers
ZedroS
> Hi ZedroS
>
[quoted text clipped - 11 lines]
>
> I Hope this will Help U.
Sandeep - 02 Feb 2006 12:59 GMT
Hi ZedroS
Write this code in Infopath managed Jscript
expl:
Month starts to 0.
0 is jan.
So we can write here 5 means May.
("/my:myFields/my:field2") this is xpath of your field.
Past this code in OnLoad Function.
dtNextMonth = new Date();
dtNextMonth.setMonth(5);
XDocument.DOM.selectSingleNode("/my:myFields/my:field2").text = dtNextMonth;
I hope this will help U

Signature
Sandeep
www.autonomysystems.com
ZedroS - 03 Feb 2006 12:51 GMT
Hi Sandeep
Apparently the post I've made just before didn't make it.
So, once again ;) :
Thanks a lot ! Your help is most helpful to me !
However, the solution you offered doesn't work, at least, I think, for two
reasons :
- the name of the field where I want to put the default is different from
the data in my DOM. They are linked through a "data source".
- the field I want to interact with is situated in a optionnal section... I
don't know if it really matters but...
If you have any other clue I will happily take it !
Cheers
ZedroS
> Hi ZedroS
>
[quoted text clipped - 13 lines]
>
> I hope this will help U