Is there a way to save master form from detail form?

Hi, i have a master detail form. I’m using sc_master_value(); to update a field in my master form.

The problem is that in order for my code in OnAfterInsert and OnBeforeDelete to work properly, the master form needs to save each time sc_master_value() changes something. how can I save my master form from detail?

I advise you, do ajax events and update your fields on that road. Sc_master_value operates well, on the form but not in details.

Use the macro sc_exec_sql update table field={field} where …

From the detail form, you can trigger a click event on the update button located on the master form with something like this:

echo "<script>$('#sc_b_upd_t',parent.document).click();</script>";

If you need to run it from an ajax event , wrap it as a function and then trigger it via sc_ajax_javascript.

Note that the update button name (“sc_b_upd_t” ) could change according to the button position in the form (I suspect that the “_t” stands for top) so check it in your browser by inspecting it.