Update field values to be saved in nuBeforeSave()?
Posted: Tue Mar 07, 2023 1:27 am
Hi, I have a field in a main form that records information about where the data originally came from.
If the user updates the data in the main form and hits "Save", I want to record that the data was also edited via my nuBuilder UI.
I tried to do this in Javascript by adding a nuBeforeSave() function.
The code I added gets the form data using $('#fieldname').val(), and then updates the form data using $('#fieldname').val(newvalue).
This appears to work (in the UI only), but the new value does not get updated in the database for the record being saved (it remains unchanged).
Questions:
* Can I only update the data being saved by using PHP BS (Before Save)? (Or in other words: am I too late to influence what gets saved once I am in nuBeforeSave() ?).
* In the diagram https://wiki.nubuilder.cloud/index.php? ... ntFlow.PNG where does JS nuBeforeSave() get called (for an Edit form in my case)? Can I consider that the "Save" box in the diagram (just up and to the right of "Edit Form") is not even entered if nuBeforeSave() returns false?
If the user updates the data in the main form and hits "Save", I want to record that the data was also edited via my nuBuilder UI.
I tried to do this in Javascript by adding a nuBeforeSave() function.
The code I added gets the form data using $('#fieldname').val(), and then updates the form data using $('#fieldname').val(newvalue).
This appears to work (in the UI only), but the new value does not get updated in the database for the record being saved (it remains unchanged).
Questions:
* Can I only update the data being saved by using PHP BS (Before Save)? (Or in other words: am I too late to influence what gets saved once I am in nuBeforeSave() ?).
* In the diagram https://wiki.nubuilder.cloud/index.php? ... ntFlow.PNG where does JS nuBeforeSave() get called (for an Edit form in my case)? Can I consider that the "Save" box in the diagram (just up and to the right of "Edit Form") is not even entered if nuBeforeSave() returns false?