The data is written to the Forms Manager using the avantgo.submissionManager
object. See PODSSubmissionMgr object.
Access the submissionManager
.
Look through the forms manager for a previous submission.
Test the form title to is if it is the correct form.
If there is a previous form for this record, update the submission and return.
Code for steps 1 – 4:
var subMgr = avantgo.submissionManager; // First look to see if we have edited this // user's info before var cnt = subMgr.length; while(cnt--) { submission = subMgr[cnt]; // Handle the deleted submissions if(submission == null) continue; // this is not the one we are looking for if((submission.title != document.updateForm.empId.value)) continue; element = subMgr.submissionElementForName("lastName"); element.value = document.updateForm.lastName.value; element = subMgr.submissionElementForName("firstName"); element.value = document.updateForm.lastName.value; element = subMgr.submissionElementForName("phoneNumber"); element.value = document.updateForm.lastName.value; return; } |
Create a new form submission.
Set the form element name/value pair into the submission.
Set the submission attributes, hiding the form so the user cannot edit it from the Forms Manager (they can simply edit the form again), then trash the response.
Set the title of the submission as the ID of the database record so that you can uniquely identify the submission, preventing multiple submissions for an individual record.
Return to the previous page.
Code for steps 5 – 9:
subm = subMgr.createSubmission(0, new Date(), 0, 0, 0, 0, 0, 0, 0); subm.appendSubmissionElement( subm.createSubmissionElement("empId", document.updateForm.empId.value)); subm.appendSubmissionElement( subm.createSubmissionElement("lastName", document.updateForm.lastName.value)); subm.appendSubmissionElement( subm.createSubmissionElement("firstName", document.updateForm.firstName.value)); subm.appendSubmissionElement( subm.createSubmissionElement("phoneNumber", document.updateForm.phoneNumber.value)); subm.status = "UNSUBMITTED_SUBMIT_STATUS"; subm.isHidden = true; subm.trashResponse = true; subm.formIndex = 0; subm.actionMethod = "P"; subm.title = document.updateForm.empId.value; subm.sourceURL = "/EmpDir/update_employee.html"; subm.actionURL = "/EmpDir/update_emp.aspx"; subMgr.saveSubmission(subm); back(); |
For more information on using the M-Business XML API, see M-Business XML API Reference.
Send feedback about this page using email. | Copyright © 2008, iAnywhere Solutions, Inc. |