Save a value on edit form
Posted: Tue Jun 26, 2018 6:36 pm
Hey,
I have this working:
-when browsing all the companies on the Company form, after clicking on one and accessing Edit form, I can create an employee which will automatically be assigned to this company with this code:
On Company form:
On employee form:
The issue is if I create a new company (I don't select one in the browse form), and then create an employee from here, no company is assigned to the new contact since the value ENTREPRISE_ID didn't get saved with the function nuSelectBrowse(). Is there any way to add a function so that after creating a new company, the value ENTREPRISE_ID is also saved, so that it is automatically assigned to a new contact created right after ?
I have this working:
-when browsing all the companies on the Company form, after clicking on one and accessing Edit form, I can create an employee which will automatically be assigned to this company with this code:
On Company form:
Code: Select all
function nuSelectBrowse(e) {
var r = $('#' + e.target.id).attr('data-nu-primary-key');
window.ENTREPRISE_ID = r;
nuForm(nuGetProperty('form_id'), r);
}
Code: Select all
if (nuFormType() == 'edit') {
$("#contact_entreprise_id").val(window.ENTREPRISE_ID).change();
nuHasNotBeenEdited();
}