Edit field in form to produce an automatic save

Hello,

I have a form with multiple blocks with different types of data, for example, some blocks have text blocks that can be altered, and other blocks have “Select fields”. Although I have a save button, I want to save the variables every time a change occurs, for example, the size of the text or the option in the select field change.

I already searched a little bit and did not find a solution. One idea was to save automatically from X-to-X seconds, but this can be computationally expensive. Also, I saw some people talking about JavaScript buttons (Automatic saving - #6 by jsbinca), but I did not understand the procedure.

Thank you very much.

Can you set up an ajax onchange for those fields?

Hello,
I think not, because some of the blocks were constructed by a Master/Detail Form linked to grids. According to my understanding, these blocks do not appear in the options for ajax events

I found the “Reload form when value has changed” on the Select Field, which can help if I can update the table on the OnRecord event. I tried :

$update_sql = 'UPDATE my_table'; sc_exec_sql($update_sql);

But I have this error:

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

You generally need to set the columns to certain values…not just say update. If you can capture the values at that time, then update my_table set col1=[var1], col2=[var2] where (if there is a condition)