Page 2 of 3

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 9:25 am
by kev1n
You can also add debugger; before calling nuSaveAction(); to check if the function gets called.
(Developer Console needs to be open)

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 9:48 am
by kknm
kev1n wrote:You can also add debugger; before calling nuSaveAction(); to check if the function gets called.
(Developer Console needs to be open)
I see the 'Save' button turns red and the message of the 'Recording saved' window, the button turns blue, the time appears for a second and disappears.

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 10:01 am
by kev1n
When you use JS, don't forget to add .change(), otherwise the field won't be saved in the db.

E.g.

Code: Select all

$('#your_time_field').val('your time').change()

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 11:43 am
by kknm
kev1n wrote:When you use JS, don't forget to add .change(), otherwise the field won't be saved in the db.

E.g.

Code: Select all

$('#your_time_field').val('your time').change()
butt.jpg
Of course the function is written this way.
function getCurrentTime() {
var d = new Date();
var df =
nuPad2(d.getHours()) + ':' +
nuPad2(d.getMinutes());
$('#ves_vr').val(df).change();

}

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 11:52 am
by kev1n
What input format does ves_vr have?

Is the time saved if you execute getCurrentTime() in the developer console and then click on the form's Save button?

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 11:59 am
by kknm
kev1n wrote:What input format does ves_vr have?

Is the time saved if you execute getCurrentTime() in the developer console and then click on the form's Save button?
I don't need the user to select and save time. I need to know the moment at what time he took the readings to write the data to the database.

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 12:08 pm
by kev1n
This is just to test if saving works in general.

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 12:13 pm
by kknm
kev1n wrote:This is just to test if saving works in general.
After executing getCurrentTime in the console and pressing the red button, the value disappears.

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 12:15 pm
by kev1n
kev1n wrote:What input format does ves_vr have?
Please check that and also the db column type.

Re: Save the time of pressing the button on the form.

Posted: Fri Feb 05, 2021 12:21 pm
by kknm
kev1n wrote:
kev1n wrote:What input format does ves_vr have?
Please check that and also the db column type.
object.png