// ID of the (hidden) form field used to store the JSON representation of the // object being edited in this page var sJsonFieldId = 'json_object'; // The memory representation of the object var oObj = {}; // Mapping between the fields of the form and the attribute of the current object // If aFieldsMap[2] contains 'foo' it means that oObj.foo corresponds to the field // of Id 'att_2' in the form var aFieldsMap = new Array; // Update the whole object from the form and also update its // JSON (serialized) representation in the (hidden) field function UpdateObjectFromForm(aFieldsMap, oObj) { for(i=0; i 0) { alert('Please fill-in all mandatory fields before continuing.'); $('#'+sFormId+' :submit').attr('disable', ''); $('#'+sFormId+' :button[type=submit]').attr('disable', ''); if (firstErrorId != '') { $('#'+firstErrorId).focus(); } } return(iErrorsCount == 0); }