cancel
Showing results for 
Search instead for 
Did you mean: 

fill fields with actual date / timestamp with button

Former Member
0 Kudos

Hello,

I did not find an answer for my following problem.

I want to put a button my adobe form that fills automactically three fields with data from the PC which are:

actual time (of the PC and of course timezone info), date and username, so the User has to press one button to fill all these data for convenience.

So I think it is necessary to program this in JavaScript as an "on-click" action. Since I'am not too much familiar with this, it would be great if someone can post a little sample coding for this (or has some other tipp).

regards and happy xmas

Jörg

Accepted Solutions (1)

Accepted Solutions (1)

NoJo
Active Participant
0 Kudos

you must have target fields for your Date, Time and Username, for example you have a structure in your data view called "ZINFO" with the fields "EDATE", "ETIME","ENAME"

in your layout you need a button where you click on

in the click event you can fill your fields (formcalc)

xfa.resolveNode("xfa.record.ZINFO.EDATE").value = Num2Date(Date(), "DD/MM/YYYY");   
xfa.resolveNode("xfa.record.ZINFO.ETIME").value = Num2Time(Time(), "HH:MM:SS", "de_DE");

so you always get time/date when clicking

but how do you know who has opened the form?? did you realize some password protection??

br norbert

Answers (6)

Answers (6)

OttoGold
Active Contributor
0 Kudos

BTW: this solution has nothing to do with the thing you´ve asked, this is server information and not the client. If the user is working with the form he might not be the one who has generated this form out of the system. But I am glad you´ve got your solution...

Former Member
0 Kudos

Hello Norbert,

thank you for the solution, that is what is was looking for!

Got it working in the form regarding date and time.

What I have found out so far is, that it is not so easy to get the userinfo. I have seen some hints, that it would require some javascript program being installed on the client system that is then called by the form!

The forms script does not have access to the client OS reading that information (e.g. Windows login-user).

thanks

Jörg

OttoGold
Active Contributor
0 Kudos

Hello,

Place a Text on your form (simple static text). Jump in the text/ edit text and right mouse click. In the menu I can see (except others) these items:

Floating field

Current page number

Number of Pages

Current Date/Time <<<<----- this could be the thing you need, I get output like: 2010-01-06 10:47:07

Viewer Locale

Viewer Name

Viewer Version

I don´t know how to get a user name. I used to search for a solution how to get any user name, but that is very difficult. If I remember well I found some proposal how to get the computer name in runtime but I have never tried so I cannot prove it that worked. To get the logged user would be even more complicated in my opinion. Maybe you will be able to create a work-around to achieve this, in that case I would be very interested in the solution.

Maybe some extra-special-combo-Adobe guy could help you, but your task is not "a common thing".

Regards, Otto

Former Member
0 Kudos

Hello,

starting in the new year again with this...

So what I need for "ease if use" to the enduser (reducing user input activities) a button that sets the actual runtime at point of time pressing this button ( adobe reader device time!) time information into defined fields (date/time/timezone).

The information might be overwritten if necessary.

(P.s. the user is doing a measurement and filling this document, the measurement time should be set just by a ticking the mentioned button and the user just needs to enter the measurement data manually).

perhaps someone has further ideas...

best wishes for 2010!

Jörg

Former Member
0 Kudos

Hi,

sorry of course I'am talking about an offline scenario.

The user is just filling the form on his PC while not connected...

chintan_virani
Active Contributor
0 Kudos

If it's a Offline scenario then there will be no logged in user, so you would not get any username ! What us your username requirement?

I don't have access to Designer currently but below steps should give you some direction.

1. Drag and drop the DateTimeField from Standard Library

2. Goto Object palette --> Value tab --> Select Calculated Read Only --> Select Runtime --> Current Data/Time from dropdown.

I will try to write the code for timestamp, meanwhile you can also take a look at the help section of Adobe Designer and search for Date & Time functions out there.

Chintan

chintan_virani
Active Contributor
0 Kudos

Is this an online / offline form ?

1. Username : user logged into Portal, correct? If yes then you can get the username through Web Dynpro coding, store it in a context and bind it to a textfield in Adobe form which will display the value.

2. I think if it is online then you will always get server time and not client PC time.

Chintan