Set Date Field With Button Click

F

Fishman4

I have a button that will send the form via email when it is clicked. Is
there a way to set a field to the date and time of the button event? I have
wandered through the rules and conditions for hours and no luck. Any help is
greatly appreciated.
 
A

Anuma(GGK Tech)

Hi,
You can set date filed in the onclick event. Can you use following code in
the onclick event.

Date = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");

thisxdocument.SelectSingleNode("Datenodexpath", Date).text;
 
F

Fishman4

Thank you for such a quick response. I am trying to plug your code in, but I
am not a programmer and I am struggling. I went to 'edit form code' and
found the function for the button, but how do I insert the code you provided?
 
H

Hilary Stoupa

I would think a rule would work just fine for this. Set a rule on the button
to set a field's value, select the field and use the formula now() for the
date and time. If you are also using this button for your submit action, you
would want to make sure the rule to set the field to a date is prior to your
submit rule.
 
F

Fishman4

I already tried a rule, but there is no way to select the source of the date.
When I am in the dialog, i can select the field that I want to populate, but
how do I select the button as the source?
 
F

Fishman4

You know what...I am a total moron. I got it. The rule worked fine. I
guess that after working for several hours yesterday, I got tunnel vision and
just couldn't see straight. Thanks, Hilary!
 
H

Hilary Stoupa

Oh, we all do that -- you get too close to it, forget what you've already
tried, and *bang* everything seems impossible. Glad you got it working!
 

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