Sorry - yes, you would have to write the script to perform the actions I described above.
Below is the code associated with the Copy Button (with the id of deletesignature)
function deletesignature::OnClick(eventObj) {
var vContinue;
vContinue = XDocument.UI.Confirm("This original form will be saved and closed.\r" + "In the copied form, status will be reset and digital signatures will be deleted .\r" + "Do you wish to continue?",4);
if (vContinue == 6) // if the user clicked "YES". {
CopyForm();
}
}
function CopyForm() {
var vNewDate = new Date();
var xDateTime = XDocument.DOM.selectSingleNode("/my:ChangeForm/my:General_Information/my:DateTime");
var xStatus = XDocument.DOM.selectSingleNode("/my:ChangeForm/my:General_Information/my:Status");
var vCt1 = XDocument.SignedDataBlocks.Count
var xSDBs = XDocument.SignedDataBlocks;
var rc = 0;
imo = vNewDate.getMonth() + 1;
id = vNewDate.getDate();
iy = vNewDate.getFullYear();
ih = vNewDate.getHours();
imin = vNewDate.getMinutes();
isec = vNewDate.getSeconds();
if (id < 10) id = '0' + id;
if (imo < 10) imo = '0' + imo;
if (ih < 10) ih = '0' + ih;
if (imin < 10) imin = '0' + imin;
if (isec < 10) isec = '0' + isec;
vdt = iy + "-" + imo + "-" + id + "T" + ih + "_" + imin + "_" + isec;
rc = SubmitForm();
// submit the old form.
if ((rc == 200) || (rc == 201)) {
XDocument.UI.Alert("The original form was saved! You are now working on a copy.\r If you get the Digital Signature popup, please 'Remove' all signatures."); }
else { // eventObj.ReturnStatus = false;
XDocument.UI.Alert("There were problems submitting your form. Error Code " + rc); return; }
xDateTime.text = vdt; // Phil - this is one of the fields used in the name of the form. It gets set to the current date/time to create a new record, even if the user leaves the "Title" field the same.
xStatus.text = "Planning"; // Phil - this field is being set to its initial value.
// Clear out any 'submitted' IAF tasks and task numbers from the Web Application view.
var xSubmitted = XDocument.DOM.selectNodes("/my:ChangeForm/my:Web_App_Group/my:JVM_R_Section/my:JVM_Key/my:Submitted");
var xTask_Number = XDocument.DOM.selectNodes("/my:ChangeForm/my:Web_App_Group/my:JVM_R_Section/my:JVM_Key/my:Task_Number");
for(var i=0;i<=(xSubmitted.length - 1); i++) {
xSubmitted.item(i).text = "";
xTask_Number.item(i).text = ""; }
// if there are any Digital Signatures, loop until they are removed.
do { var j = 0; for(var i=0;i<=(vCt1 - 1);i++) {
j = j + xSDBs(i).Signatures.Count; }
if (j > 0) XDocument.UI.ShowSignatureDialog(); }
while (j > 0); }
// end of code
Obviously this may not all fit with your application and you'll need to make some coding changes. This code above resets a status, and some fields that once entered, are protected. Otherwise it leaves everything else in tact, and the user has a complete copy of a previous form - this is very beneficial if the user entered a large amount of data and does not want to enter it in again on a new form.
Dave