Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
Using script and the IOL technique you can easily implement a generic technique that will allow you to add custom parameters to the common record manipulation URLs. In particular you can add the desired functionality to initialize field value of the ?a=er URL. Here is a demo and screenshot showing editing the first record with and without the custom _fid_* URL parameters::
https://haversineconsulting.quickbase.com/db/bncssrtjv?a=er&rid=1
https://haversineconsulting.quickbase.com/db/bncssrtjv?a=er&rid=1&_fid_6=Mu&_fid_8=Eta
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=616
Notes:
(1) The code in the pastie is generic and can be used to implement this functionality for any table or set of fields.
(2) The IOL field is included only for ?a=er pages
(3) This technique of adding custom properties and parsing them out in script to perform some useful action can be extended to many other use cases. For example you could easily arrange to pass the name of a code page with a parameter &script=myscript.js and within with the IOL module.js page just insert a generic $.getScript() to load the script passed in the URL.
Once I come up with a snappy name for this technique I will add it to my forthcoming QuickBase Swimlane Catalog (it's big and chocked full of goodies):
https://haversineconsulting.quickbase.com/db/bncssrtjv?a=er&rid=1
https://haversineconsulting.quickbase.com/db/bncssrtjv?a=er&rid=1&_fid_6=Mu&_fid_8=Eta
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=616
Notes:
(1) The code in the pastie is generic and can be used to implement this functionality for any table or set of fields.
(2) The IOL field is included only for ?a=er pages
(3) This technique of adding custom properties and parsing them out in script to perform some useful action can be extended to many other use cases. For example you could easily arrange to pass the name of a code page with a parameter &script=myscript.js and within with the IOL module.js page just insert a generic $.getScript() to load the script passed in the URL.
Once I come up with a snappy name for this technique I will add it to my forthcoming QuickBase Swimlane Catalog (it's big and chocked full of goodies):
_anomDiebolt_
8 years agoQrew Elite
FWIW, I modified the code to do a destructuring assignment as indicated below::
(function(){
var querystring=document.location.search;
if(/a=er/i.test(querystring)) {
var params = new URLSearchParams(location.search);
for (var [fid, value] of params.entries()) {
if (fid.indexOf("_fid_") == 0) {
$("#" + fid).val(value);
}
}
}
})();