Welcome to the nuBuilder Forums!

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

Query - Dynamic saving

Questions related to using nuBuilder Forte.
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Query - Dynamic saving

Unread post by Dalkeith »

As pretty much a complete beginner I am interested in implementing something that automatically saves the field on exit of the field within the edit form..

I did find something by Janusz that resembled what I needed but I really could do with a complete beginners guide.

Could someone point me / give some guidance for an efficient solution?

Ta
My Blog - cloudydatablog.net https://cloudydatablog.net/
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Query - Dynamic saving

Unread post by kev1n »

Hi,

If the form is not saved yet you'd have to save it first to create the record in the database.
Use the onblur event to detect when an object loses focus.
(Add this event in the objects's Custom Code tab)
Then call a PHP procedure with nuRunPHPHidden() to save the field to the db. Before executing the Procedure, set a Hash Cookie with nuSetProperty() to know which field has to be saved.

Let me know if you need more details.
apmuthu
Posts: 249
Joined: Sun Dec 06, 2020 6:50 am
Location: Chennai, India, Singapore

Re: Query - Dynamic saving

Unread post by apmuthu »

A screenshot and a list of functions to be called would be in order.
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Query - Dynamic saving

Unread post by Dalkeith »

Thank you Kevin Apmuthu I will have a go at the weekend.
My Blog - cloudydatablog.net https://cloudydatablog.net/
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Query - Dynamic saving

Unread post by kev1n »

Were you able to implement this or do you need more guidance?
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Query - Dynamic saving

Unread post by Dalkeith »

Hi Kevin I ran out of time but I didn't understand the instructions if I am honest. I was hoping to have some quick fix to make all edit forms dynamically save on field exit.
My Blog - cloudydatablog.net https://cloudydatablog.net/
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Query - Dynamic saving

Unread post by kev1n »

I created a small autosaving demo at https://test.nubuilder.cloud/
It might not be perfect yet but should help you get going.

Login credentials:
User: test
Password: nutest

User Home -> autosave Button

It makes use of the autosaveForm PHP Procedure:
https://test.nubuilder.cloud/index.php? ... e43b9b3be3

The logic at the moment is as follows:

The first time a blur event occurs and a field's value is changed, the (entire) form is saved to create a record in the table.
For each subsequent blur event only the edited field is saved by executing the autosaveForm Procedure. This is also faster than saving the whole form.
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Query - Dynamic saving

Unread post by Dalkeith »

Thank you Kevin I will try it out
My Blog - cloudydatablog.net https://cloudydatablog.net/
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Query - Dynamic saving

Unread post by kev1n »

Demo updated: The focus is retained when the form is saved for the first time.
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Query - Dynamic saving

Unread post by Dalkeith »

Works really really great Kev1n

I do note that the date field doesn't seem to work not sure why
My Blog - cloudydatablog.net https://cloudydatablog.net/
Post Reply