Hi there ,
i have time select field as exit time , when user open the form i want time field should auto select current time .
Note: Filed is not read-only or appgini auto <%%creationTime%%> . please help!!
Default current time in input field.
-
- Veteran Member
- Posts: 32
- Joined: 2021-06-12 21:01
Re: Default current time in input field.
Hi there,
I am using javascript (hooks) to achieve this.
Put the following code in the hooks/TABLENAME-dv.js file (create one if you don't have it yet)
* Replace the TABLENAME and TIMEFIELD with yours.
Refresh / clear cache of your browser and the current time should be populated if it is a new record.
Good luck.
I am using javascript (hooks) to achieve this.
Put the following code in the hooks/TABLENAME-dv.js file (create one if you don't have it yet)
Code: Select all
// populate curent date time for NEW record
$j(function () {
// check if data (record) exist or not
if ($j('#TIMEFIELD').val()) return;
// populate the current date time (using moment.js)
$j('#TIMEFIELD').val(moment().format('hh:mm:ss A'));
});
Refresh / clear cache of your browser and the current time should be populated if it is a new record.
Good luck.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.