The form is in a modal popup and the button is in the modal footer. It checks the Id field and if it’s null, it sets the ‘action’ field to ‘insert’, otherwise it sets it to ‘update’, then submits the form and then calls the server connect refresh. The server action, then looks for the action value and acts accordingly.
<button type="button" class="btn btn-primary"
dmx-on:click="run([{condition:{if:`(modal_edit_employee.form_edit_employee.inp_Id.value == null)`,then:{steps:{run:{action:`modal_edit_employee.form_edit_employee.inp_action.setValue(\'insert\')`}}},else:{steps:{run:{action:`modal_edit_employee.form_edit_employee.inp_action.setValue(\'update\')`}}}}},{run:{action:`modal_edit_employee.form_edit_employee.submit();modal_edit_employee.hide();sc_employees.load({offset: query.offset, limit: query.limit, sort: query.sort, dir: query.dir, action: \'list\'},true)`}}])">Save
changes</button>
Here is a screenshot of the server action, with the ‘update’ action expanded: