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
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Query - Dynamic saving
-
- Posts: 40
- Joined: Thu Jun 23, 2016 10:33 am
- Location: Edinburgh
- Contact:
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Query - Dynamic saving
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.
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.
-
- Posts: 249
- Joined: Sun Dec 06, 2020 6:50 am
- Location: Chennai, India, Singapore
-
- Posts: 40
- Joined: Thu Jun 23, 2016 10:33 am
- Location: Edinburgh
- Contact:
Re: Query - Dynamic saving
Thank you Kevin Apmuthu I will have a go at the weekend.
My Blog - cloudydatablog.net https://cloudydatablog.net/
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
-
- Posts: 40
- Joined: Thu Jun 23, 2016 10:33 am
- Location: Edinburgh
- Contact:
Re: Query - Dynamic saving
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/
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Query - Dynamic saving
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.
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.
-
- Posts: 40
- Joined: Thu Jun 23, 2016 10:33 am
- Location: Edinburgh
- Contact:
Re: Query - Dynamic saving
Thank you Kevin I will try it out
My Blog - cloudydatablog.net https://cloudydatablog.net/
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Query - Dynamic saving
Demo updated: The focus is retained when the form is saved for the first time.
-
- Posts: 40
- Joined: Thu Jun 23, 2016 10:33 am
- Location: Edinburgh
- Contact:
Re: Query - Dynamic saving
Works really really great Kev1n
I do note that the date field doesn't seem to work not sure why
I do note that the date field doesn't seem to work not sure why
My Blog - cloudydatablog.net https://cloudydatablog.net/