Query - Dynamic saving

Questions related to using nuBuilder Forte.

Query - Dynamic saving

Unread postby Dalkeith » Sun Mar 07, 2021 8:00 pm

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/
Dalkeith
 
Posts: 36
Joined: Thu Jun 23, 2016 6:03 pm
Location: Edinburgh

Re: Query - Dynamic saving

Unread postby kev1n » Sun Mar 07, 2021 8:22 pm

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.
kev1n
nuBuilder Team
 
Posts: 1623
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Query - Dynamic saving

Unread postby apmuthu » Mon Mar 08, 2021 9:41 pm

A screenshot and a list of functions to be called would be in order.
apmuthu
 
Posts: 248
Joined: Sun Dec 06, 2020 3:20 pm
Location: Chennai, India, Singapore

Re: Query - Dynamic saving

Unread postby Dalkeith » Wed Mar 10, 2021 2:25 am

Thank you Kevin Apmuthu I will have a go at the weekend.
My Blog - cloudydatablog.net https://cloudydatablog.net/
Dalkeith
 
Posts: 36
Joined: Thu Jun 23, 2016 6:03 pm
Location: Edinburgh

Re: Query - Dynamic saving

Unread postby kev1n » Sun Mar 21, 2021 2:18 am

Were you able to implement this or do you need more guidance?
kev1n
nuBuilder Team
 
Posts: 1623
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Query - Dynamic saving

Unread postby Dalkeith » Mon Mar 22, 2021 8:58 pm

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/
Dalkeith
 
Posts: 36
Joined: Thu Jun 23, 2016 6:03 pm
Location: Edinburgh

Re: Query - Dynamic saving

Unread postby kev1n » Mon Mar 22, 2021 10:51 pm

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.
kev1n
nuBuilder Team
 
Posts: 1623
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Query - Dynamic saving

Unread postby Dalkeith » Tue Mar 23, 2021 5:17 am

Thank you Kevin I will try it out
My Blog - cloudydatablog.net https://cloudydatablog.net/
Dalkeith
 
Posts: 36
Joined: Thu Jun 23, 2016 6:03 pm
Location: Edinburgh

Re: Query - Dynamic saving

Unread postby kev1n » Wed Mar 24, 2021 5:24 am

Demo updated: The focus is retained when the form is saved for the first time.
kev1n
nuBuilder Team
 
Posts: 1623
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Query - Dynamic saving

Unread postby Dalkeith » Wed Mar 24, 2021 6:08 am

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/
Dalkeith
 
Posts: 36
Joined: Thu Jun 23, 2016 6:03 pm
Location: Edinburgh

Next

Return to General

Who is online

Users browsing this forum: absalom, GlenMcCabe and 19 guests