Adding field in specific location using QuickBase API
Is there any way I can use the API to add a field (using Add_Field) and set where I want the field to be exactly on the form? I'm thinking if there's a relative way (e.g., before field or after field). Any suggestions?
Sorry, can't be done via the API. In fact, it can't even be done within the normal Quickbase UI. If you have your form set to automatically add new fields, they always appear at the bottom.
>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 fiveText 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);
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: