Duplicate record |
When a record is duplicated, specified boxes are emptied out and focus is set to the first one listed. |
Script Language: JavaScript | For use with: DB/TextWorks | Requires at least version 4.0 |
// Change the box names in the following array to match the
// script names of boxes in your form. Add as many box names to
// the array as needed, following the format shown (box names
// in quotes, separated by commas).
var boxNames = new Array("box1", "box2");
function onRecordDuplicate()
{
var tgtBox; // box to be cleared
var i; // loop index
// clear the contents of each box named in the array
for (i = 0; i < boxNames.length; i++)
{
tgtBox = Form.boxes(boxNames[i]);
if (tgtBox) // ensure that the box exists
tgtBox.content = ""; // and clear its contents
}
// now set focus to the first box listed
tgtBox = Form.boxes(boxNames[0]);
if (tgtBox)
tgtBox.setFocus();
} |
Notes: To adapt this script for use with a particular edit form, first supply a script name for each box whose contents you want to clear. Then modify the array at the top of the script to substitute your own box names. | Submitted by Inmagic Staff on 11/30/2000 |