Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
>Sorry, can't be done via the API. In fact, it can't even be done within the normal Quickbase UI.
I was laughing so hard my ribs were aching when I read this. This is QuickBase not Salesforce and QuickBase has reached convergence where everything is possible.
Here is how you do it with script:
(1) Call the action DFormProps to extract all the form builder properties. All the fields and their properties are stored in hidden <input> elements named hfi1 ... hfin where n is the number of form elements. This code extracts and logs all the field properties for a simple form that had five Text fields with fids=6,7,8,9,10:
(2) Now to spice in a Text Section into the third position you just POST to QBI_DformPropsSave with the modified parameters
It may look complicated but it is quite easy. Yes I am intentionally leaving out some details on purpose as you should have a good reason to do this but it is quite possible. Contact me off-world using the information in my profile if you want to pursue a solution:
https://getsatisfaction.com/people/dandiebolt/
I was laughing so hard my ribs were aching when I read this. This is QuickBase not Salesforce and QuickBase has reached convergence where everything is possible.
Here is how you do it with script:
(1) Call the action DFormProps to extract all the form builder properties. All the fields and their properties are stored in hidden <input> elements named hfi1 ... hfin where n is the number of form elements. This code extracts and logs all the field properties for a simple form that had five Text fields with fids=6,7,8,9,10:
var dbidTable = "bnh3ismip";
var dfid = "2";
$.get('${dbidTable}?a=DFormProps&${dfid}')
.then(function(html) {
var $doc = $(html);
var $form = $("form[name=mainform]", $doc);
$("input[type=hidden][name^=hfi]").each(function(input, index) {
console.log($(this).val());
});
}); Console output:
1~*~~*~6~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~
1~*~~*~7~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~
1~*~~*~8~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~
1~*~~*~9~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~
1~*~~*~10~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~
(2) Now to spice in a Text Section into the third position you just POST to QBI_DformPropsSave with the modified parameters
var dbidTable = "bnh3ismip";Here is the resulting modified form:
var body = '<qdbapi>
<showfooterbuttons>true</showfooterbuttons>
<saveandkeepworking>false</saveandkeepworking>
<dformname>Table #1 Main Form</dformname>
<hrules>true</hrules>
<builtins>true</builtins>
<wraplabels>true</wraplabels>
<ajaxembeddedreport></ajaxembeddedreport>
<newFieldBehavior>auto</newFieldBehavior>
<dfid>2</dfid>
<fruVal></fruVal>
<nextNonFieldID>2</nextNonFieldID>
<curtab>elements</curtab>
<hfi0>1~*~~*~6~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~</hfi0>
<hfi1>1~*~~*~7~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~</hfi1>
<hfi2>2~*~Text Section Here~*~0~*~0~*~0~*~0~*~0~*~0~*~-1~*~1~*~~*~0~*~0~*~0~*~0~*~</hfi2>
<hfi3>1~*~~*~8~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~</hfi3>
<hfi4>1~*~~*~9~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~</hfi4>
<hfi5>1~*~~*~10~*~0~*~0~*~0~*~0~*~0~*~-1~*~0~*~~*~0~*~0~*~0~*~0~*~</hfi5>
<withConf>1</withConf>
</qdbapi>';
$.ajax({
url: '${dbidTable}?a=QBI_DformPropsSave',
type: "POST",
contentType: "text/xml",
data: body
}).then(function(resp) {
console.log(resp);
});
Console output:
<qdbapi>
<action>QBI_DformPropsSave</action>
<errcode>0</errorcode>
<errtext>No error<errtext>
<dfid>2<dfid>
</qdbapi>
It may look complicated but it is quite easy. Yes I am intentionally leaving out some details on purpose as you should have a good reason to do this but it is quite possible. Contact me off-world using the information in my profile if you want to pursue a solution:
https://getsatisfaction.com/people/dandiebolt/