Forum Discussion
QuickBaseCoachD
8 years agoQrew Captain
So you cannot actually populate a checkbox field when opening the record to edit.
The only option would be to actually have that checkbox set to checked under the covers and then display the record in Edit mode.
The subtle difference is that when the user clicks the button, that checkbox will be checked, regardless if they choose to back out of the edit process and not actually save the record.
The code would be in two steps like this, using formula variables for each step.
var Checkbox= URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=xxxxxxx"
& "&_fid_155=1;
var Edit = URLRoot() & "db/" & Dbid() & "?a=er&key="&[Record ID#]&"&dfid=11";
$Checkbox
& "&rdr=" & URlEncode($Edit)
If you have application tokens set to be required you will need to supply that line
& "&apptoken=xxxxxxx"
or else disable them on the Settings in App properties and then you don't need that line.
The only option would be to actually have that checkbox set to checked under the covers and then display the record in Edit mode.
The subtle difference is that when the user clicks the button, that checkbox will be checked, regardless if they choose to back out of the edit process and not actually save the record.
The code would be in two steps like this, using formula variables for each step.
var Checkbox= URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=xxxxxxx"
& "&_fid_155=1;
var Edit = URLRoot() & "db/" & Dbid() & "?a=er&key="&[Record ID#]&"&dfid=11";
$Checkbox
& "&rdr=" & URlEncode($Edit)
If you have application tokens set to be required you will need to supply that line
& "&apptoken=xxxxxxx"
or else disable them on the Settings in App properties and then you don't need that line.
_anomDiebolt_
8 years agoQrew Elite
But this is easy to do with script and IOL:
Here is a screenshot of me manually applying a three line script
So the IOL module.js code page would be this simple script:
This is actually a perfect example of my JavaScript rant yesterday which was probably over most user's heads but is simple to understand in this instance.
JavaScript keeps getting better every day. Now there is (1) a new object available named URLSearchParams that will allow you to manipulate the URL's query parameters and (2) the browser automatically creates globals for all element ids in the page (ie _fid_6 and _fid_7).
You will not see URLSearchParams anywhere in QuickBase's code base but you will find various legacy code fragments that does the same thing. It isn't QuickBase's fault - every software company experiences this problem as the technology is changing too fast for even senior developers to keep up. Quite frankly I would be surprised if many QuickBase developers even know about these two particular features. Except that cute one - she seems like she knows her stuff.
Here is a screenshot of me manually applying a three line script
var urlParams = new URLSearchParams(window.location.search);
_fid_6.value = urlParams.get('_fid_6');
_fid_7.value = urlParams.get('_fid_7');
So the IOL module.js code page would be this simple script:
(function(){
var querystring=document.location.search;
if(/a=er/i.test(querystring)) {
var urlParams = new URLSearchParams(window.location.search);
_fid_6.value = urlParams.get('_fid_6');
_fid_7.value = urlParams.get('_fid_7');
}
})();
This is actually a perfect example of my JavaScript rant yesterday which was probably over most user's heads but is simple to understand in this instance.
JavaScript keeps getting better every day. Now there is (1) a new object available named URLSearchParams that will allow you to manipulate the URL's query parameters and (2) the browser automatically creates globals for all element ids in the page (ie _fid_6 and _fid_7).
You will not see URLSearchParams anywhere in QuickBase's code base but you will find various legacy code fragments that does the same thing. It isn't QuickBase's fault - every software company experiences this problem as the technology is changing too fast for even senior developers to keep up. Quite frankly I would be surprised if many QuickBase developers even know about these two particular features. Except that cute one - she seems like she knows her stuff.