Difference between revisions of "AJAX - Function - dbUpdateRecord"

From All n One's bxp software Wixi

Jump to: navigation, search
 
Line 52: Line 52:
 
 
 
//Function specific settings
 
//Function specific settings
−
aryAjax_Settings[34]     = 'strCDA_1_field_0_1,strCDA_1_field_0_2'; //Fields in other form to update
+
aryAjax_Settings[34] = 'strCDA_1_field_0_1,strCDA_1_field_0_2'; //Fields in other form to update
−
aryAjax_Settings[35]     = varValue1 + ',' + document.getElementById('intCDA_Id').value; //Values to update with in the other form
+
aryAjax_Settings[35] = varValue1 + ',' + document.getElementById('intCDA_Id').value; //Values to update with in the other form
−
aryAjax_Settings[36]     = 'intCDA_1_Id';  //Id field to match on
+
aryAjax_Settings[36] = 'intCDA_1_Id';  //Id field to match on
−
aryAjax_Settings[36]     = document.getElementById('strCDA_1_field_0_1').value; //Id value to match on
+
aryAjax_Settings[36] = document.getElementById('strCDA_1_field_0_1').value; //Id value to match on
  
 
//Execute
 
//Execute

Latest revision as of 07:50, 31 August 2016

1 Primary Function

This function will update a record in another Form and store the matched Id in a field on the current page.


2 Example uses

  • Quick update items in another form
  • Quick update contacts to a company in another form


3 Code

/******************************************************************************************************
Application: This function ............
Version [1.0] Date [2016-08-29] Author [PJ]
******************************************************************************************************/
function fn_FunctionName(){
	if (typeof aryAjax_Settings=='undefined') { alert('Library did not load'); }
	else {
		// Clear all settings
		fn_Ajax_bxp_ResetSettings();

		// Security Settings
		aryAjax_Settings[0] 		= 'client_demo';
		aryAjax_Settings[22] 		= document.getElementById('intSystemGenerated_CompanyId').value;		//Auto Login - System
		aryAjax_Settings[23] 		= document.getElementById('intSystemGenerated_UserId').value;			//Auto Login - User
		aryAjax_Settings[24] 		= document.getElementById('intSystemGenerated_LoginKey').value;			//Auto Login - SessionId

		// Retrieval Settings
		aryAjax_Settings[16] 		= 'dbUpdateRecord';                 									//Engine to use
		aryAjax_Settings[3] 		= 1;																	//The form to insert into
		aryAjax_Settings[4] 		= 'null'; 																//The field to search on
		aryAjax_Settings[5] 		= 'null'; 																//The value to limit by
		aryAjax_Settings[13] 		= '-1'																	//Limit response
		
		//Display management
		aryAjax_Settings[15] 		= 'divWarning';               											//Where to draw error messages if any
		
		//Common Functional settings
		aryAjax_Settings[6] 		= 'intCurrentIdOfRecordUpdated';										//Has to be this value to match XML
		aryAjax_Settings[12] 		= 'Id_Of_Updated_Record';                       						//XML header for troubleshooting
		aryAjax_Settings[17] 		= 'strCDA_1_field_0_1';   												//Field on the current page where the matched CDA Id will be written
		aryAjax_Settings[28] 		= '';																	//Function to be executed after retrieval
		
		//Function specific settings
		aryAjax_Settings[34] 		= 'strCDA_1_field_0_1,strCDA_1_field_0_2';								//Fields in other form to update
		aryAjax_Settings[35] 		= varValue1 + ',' + document.getElementById('intCDA_Id').value;  		//Values to update with in the other form
		aryAjax_Settings[36] 		= 'intCDA_1_Id';  														//Id field to match on
		aryAjax_Settings[36] 		= document.getElementById('strCDA_1_field_0_1').value;  				//Id value to match on

		//Execute
		fn_Ajax_bxp_Process();																				//The main execution of the AJAX
		
		//Write URL out (Comment out after testing)
		if (document.getElementById('divURL')){
			document.getElementById('divURL').innerHTML = "<a href='" + aryAjax_Settings[7] + "' target='_blank'>Constructed AJAX URL</a>";
		}
	}
}


4 Troubleshooting

For any errors messages and troubleshooting AJAX please read here AJAX_-_Error_messages_and_troubleshooting


5 Associated reading

For all our custom AJAX functions please read here AJAX_-_Start_Here


For the full array of all possible parameters please read here AJAX_-_Full_Array_of_Parameters


For how the security engine of AJAX works AJAX_-_Security_engine