I need to create a button on my InfoPath 2007 form.

L

Leo

I need to create a button on my InfoPath 2007 form that will do the following:

When I click the button, it will assign a formatted date (just the day of
the week)+ time (like: MON0535) to a textbox that it is also on my form.

Ist that possible?
Thanks.
 
S

Shekar

Hi Leo
Create a date object

var date = new Date();

Create an array with week names as follows:
var dayArray = new Array();
dayArray[0] = "SUN";
dayArray[1] = "MON";
dayArray[2] = "TUE";
dayArray[3] = "WED";
dayArray[4] = "THU";
dayArray[5] = "FRI";
dayArray[6] = "SAT";

XDocument.DOM.selectSingleNode("/my:myFields/my:field5").text =
dayArray[date.getDay()] +
date.toLocaleTimeString().replace(":","").replace(":","");

Hope this helps you.
 
L

Leo - the 4 year old child. :-)

Shekar,

Thanks for responding to my question. I think this will do the trick but I
have a couple follow up questions for you.

1) Would this work for a form that is browser enable?
2) Is this a vb code and if so, could you please elaborate a bit more on how
to I place this code on my form?

Here's where I'm coming from:
I very new at programming and am not sure how to utilize this.

Here are the details on what I'm tring to do:
I have a for that will send new passwords to users. The form has a textbox
named "NewPwd" and a button named "SendPwd (button ID btnSendPwd)
I want to click on the button and have the password (like: MON0535) be
placed on the field "NewPwd" that is going to be sent to the user via email.

On my very little experience with programming I have the impression that
your code would work but am not just how to do it.

Think of me as a 4 year child that needs to be told all the details on how
to change my own diapler. Lol!!!

I need step by step. Help me! Lol!!!! :)

Many thanks in advance.
Leo.

Shekar said:
Hi Leo
Create a date object

var date = new Date();

Create an array with week names as follows:
var dayArray = new Array();
dayArray[0] = "SUN";
dayArray[1] = "MON";
dayArray[2] = "TUE";
dayArray[3] = "WED";
dayArray[4] = "THU";
dayArray[5] = "FRI";
dayArray[6] = "SAT";

XDocument.DOM.selectSingleNode("/my:myFields/my:field5").text =
dayArray[date.getDay()] +
date.toLocaleTimeString().replace(":","").replace(":","");

Hope this helps you.

Leo said:
I need to create a button on my InfoPath 2007 form that will do the following:

When I click the button, it will assign a formatted date (just the day of
the week)+ time (like: MON0535) to a textbox that it is also on my form.

Ist that possible?
Thanks.
 

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