Smart Editor: pass URL parameters to fields as pre-defined value to be edited

108
0
09-28-2021 09:29 AM
helenchu
Occasional Contributor II

All,

I'm trying to pass URL parameters as pre-defined values for fields to be edited.  I have these codes at the opening function.  My issue now is it only populates the 1st time for the 1st record to be edit. If I want to edit more records the value won't stay.  Any idea on how I could fix that?   Thank you very much.

onOpen: function () {
1333
if (this._userHasPrivilege === true) {
1336
if (this._userHasPrivilege === true) {
1334
//this.fetchDataByName('GroupFilter');
1337
//this.fetchDataByName('GroupFilter');
1335
this._workBeforeCreate();
1338
this._workBeforeCreate();
1336
//Activate the widget after some time to make sure the components are loaded
1339
//Activate the widget after some time to make sure the components are loaded
1337
setTimeout(lang.hitch(this, function () {
1340
setTimeout(lang.hitch(this, function () {
1338
this.widgetManager.activateWidget(this);
1341
this.widgetManager.activateWidget(this);
1339
}), 100);
1342
}), 100);
1340
}
1343
}
1344
/////////////////  inject subjectID and run_id ///////////////////////
1345
function getParameterByName(name, url = window.location.href) {
1346
name = name.replace(/[\[\]]/g, '\\$&');
1347
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
1348
results = regex.exec(url);
1349
if (!results) return null;
1350
if (!results[2]) return '';
1351
return decodeURIComponent(results[2].replace(/\+/g, ' '));
1352
}
1353

1354
let acct = getParameterByName('find');
1355
let run_id = getParameterByName('run_id');
1356
let tb_acct = document.getElementById("dijit_form_ValidationTextBox_12");
1357
let tb_run_id = document.getElementById("dijit_form_ValidationTextBox_13");
1358
if(tb_acct !== null){
1359
tb_acct.value = acct;
1360
tb_run_id.value = run_id;
1361
console.log("Here1",acct);
1362
console.log("Here2",run_id);
1363
}
1364
//////////////////////////////////////////////////////////////////////////

 

0 Kudos
0 Replies