Can I create buttons to open add record screens using different Forms?

  • 2
  • 1
  • Question
  • Updated 3 years ago
  • Answered

So basically I would like one button to open an Add Record screen with one Form, and then another button to open an Add Record screen within the same table using a different Form.

Photo of Chris_MCD

Chris_MCD

  • 0 Points

Posted 4 years ago

  • 2
  • 1
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
You can do this by specifying the "dfid" (form id) in your buttons.

In your table settings, under Forms, you should see the "Form Id" column. Note down these Form Ids for the 2 different forms you want to use.

Then - go to your "Add Record" button, and edit the field properties.

The formula may look something like this:

URLRoot() & "db/" & [_DBID_INSERT_YOUR_TABLE_DBID] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl()

So now just insert the following at the end - replaced "2" with whatever your Form Id is: & "&dfid=2"

So the final button formula looks something like this:

URLRoot() & "db/" & [_DBID_INSERT_YOUR_TABLE_DBID] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=YOUR_FORM_ID"

(replacing the INSER_YOUR_TABLE_DBID and YOUR_FORM_ID with your values)
Photo of Chris_MCD

Chris_MCD

  • 0 Points
Ok, so in this instance, the "Add Record" button would have to be an URL Formula field that I add to the table in order to do this correct? Or is it possible to edit the properties of the default button provided by the tables?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Correct - you'd need to create your own Formula URL buttons.  In native QuickBase, you will not be able to edit the properties of the default buttons (and links) provided by the tables.
Photo of Chris_MCD

Chris_MCD

  • 0 Points
Right, ok, I figured as much. Just wanted to make sure there wasn't something I was not aware of yet. I will give this a try and let you know how it goes, thanks!
Photo of Chris_MCD

Chris_MCD

  • 0 Points
So I tried this and I am getting a Syntax Error for possible missing parentheses or missing quotes. Unfortunately I am not versed enough in this to recognize what is missing, any thoughts?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Can you post your button formula?  And please list your tables, and which table the "Add Record" button is on.  We'd need the dbid for the table as well.  

For the table dbid, you can go to the Table settings > Advanced Setting, look at the bottom and see Table alias (e.g. "_DBID_TABLE_1").

Or go to the app settings > App management > Show support information.  There the tables are listed, along with their dbids.
Photo of Chris_MCD

Chris_MCD

  • 0 Points
Honestly I had just copied and pasted the formula you provided and changed [_DBID_INSERT_YOUR_TABLE_DBID] to our DBID which is bbsv54njz, table ID is bhte475rk, so it looked like this,

URLRoot() & "db/" & bbsv54njz & "?a=API_GenAddRecordForm&_fid_10=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=10"
Photo of Chris_MCD

Chris_MCD

  • 0 Points
Actually, I think I figured it out, I need t put the table ID in where I was putting the DBID and add " to each side and it worked...
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Great!  Yeah - the app itself has a DBID.  What you want there is the table DBID.
Photo of Chris_MCD

Chris_MCD

  • 0 Points
Yup, and I was just getting those mixed up. Thanks so much for your assistance!
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
You're welcome!
Photo of Kazim

Kazim

  • 0 Points
what if you need to add your new record in another table?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
The formula should still work - just replace [_DBID_INSERT_YOUR_TABLE_DBID] with the table DBID of the table where you want the new records to be added.
Hi Xavier,

can i create a button that add a record in different application and return to source app ?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Hi - please create a new post with your question.  That way we can keep the individual questions focused.  Thanks!
Photo of Jack Edward

Jack Edward

  • 0 Points
Hello, I'm attempting something similar (One table with two different forms and I'd like two seperate 'Add Record' buttons linked to each form) yet I keep getting "This site can't be reached" error "ERR_NAME_NOT_RESOLVED".

URL formula in Add Button properties " URLRoot() & "db/" & "_DBID_EXPERIMENTS" & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=10" "

"_DBID_EXPERIMENTS" is the table alias I'd like to link to
10 is the form_id number I'd also like to link to.

If you could help me find the error in the formula, I'd greatly appreciate it.  Thank you very much.
Photo of Ceci New York

Ceci New York

  • 0 Points
.
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Instead of "_DBID_EXPERIMENTS" - use [_DBID_EXPERIMENTS] .  You need to put the square brackets around the DBID, not quotes.

So something like this:

URLRoot() & "db/" & [_DBID_EXPERIMENTS] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=10"
Photo of Jack Edward

Jack Edward

  • 0 Points
Thank you very much for responding!  I'm still getting the same error though with the brackets [] in place of the "" around _DBID_EXPERIMENTS.  

Error = "This site can't be reached.  urlroot%28%29%20%26%20%22db’s server DNS address could not be found.  Search Google for urlroot "db DBID EXPERIMENTS]  ERR_NAME_NOT_RESOLVED"

After saving, this is copy/paste from button's URL formula:
http://URLRoot() & "db/" & [_DBID_EXPERIMENTS] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=10"
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
Remove the http:// at the beginning.  URLRoot() already contains that text.
Photo of Jack Edward

Jack Edward

  • 0 Points
Right, that's ("http://") added automatically when I save.  Can/should I turn off that auto-add feature somehow?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
This formula should be in a Formula URL field.  (Not a URL field).

What kind of field is this in?
Photo of Jack Edward

Jack Edward

  • 0 Points
I guess URL Field (from page settings->button properties->URL).  How do I access a button's formula URL field?
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
You would need to change the Type to "Formula - URL".  Then in the field settings, you'll see a Formula section where you can put in the formula.