Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Save the time of pressing the button on the form.

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post by kev1n »

You can also add debugger; before calling nuSaveAction(); to check if the function gets called.
(Developer Console needs to be open)
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

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

Unread post 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.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post 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()
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

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

Unread post 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();

}
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post 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?
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

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

Unread post 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.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post by kev1n »

This is just to test if saving works in general.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

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

Unread post 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.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post by kev1n »

kev1n wrote:What input format does ves_vr have?
Please check that and also the db column type.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

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

Unread post by kknm »

kev1n wrote:
kev1n wrote:What input format does ves_vr have?
Please check that and also the db column type.
object.png
You do not have the required permissions to view the files attached to this post.
Post Reply