Forum Discussion

ChrisSwirtz2's avatar
ChrisSwirtz2
Qrew Cadet
5 years ago

Utilizing a different form when clicking the "Add Record" button

I'm looking to have a user utilize a different form to add a record to a table depending on which table they are adding the record from.

I assume this can be done via some sort of URL Report field , just not sure where to indicate what form it is routed to in the child table.

------------------------------
Chris Swirtz
------------------------------

12 Replies

  • DonLarson's avatar
    DonLarson
    Qrew Commander
    Chris,

    Here is an example that works the way Austin laid out

    var text URLGenAdd =
      URLRoot() & "db/" & Dbid() &
      "?a=API_GenAddRecordForm&_fid_8=" & URLEncode ([Record ID#])&
      "&dfid=10" &
      "&z=" & Rurl();


    This will add a new record using Form Ten.  It also fills in field 8 with the Record ID # from where you started.

    Change Dbid() to a table alias to pick a different table to be adding the record using Form Ten from that table.ā€‹

    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------
    • ChrisSwirtz2's avatar
      ChrisSwirtz2
      Qrew Cadet
      So this is the code I end up with:

      var text URLGenAdd=URLRoot() & "db/" & [_DBID_PERIPHERALS] & "?a=API_GenAddRecordForm&_fid_15" & URLEncode ([Record ID#])&"&dfid=11" & "&z=" & Rurl();

      But it puts a little yellow mark at the end and gives me an error. What am I doing wrong?

      ------------------------------
      Chris Swirtz
      ------------------------------
      • ChrisSwirtz2's avatar
        ChrisSwirtz2
        Qrew Cadet
        It accepted the code before when I originally forgot to add the "var text URLGenAdd =" part of the formula but when I clicked the button it still just took me to the add new record utilizing the main form, not form 11 like I want it to.

        When I hover the cursor over the yellow section a note pops up saying "Expecting Test"


        ------------------------------
        Chris Swirtz
        ------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    You can either pick what form each role will use for Add, Edit, or View on the table itself in the Forms section under "Set how different roles use these forms" or you can set it in the URL by doing &dfid=MyFormNumberHere. I'm not positive the first one would work when doing it via the URL but you could explore that and see. I think it should work.

    Edit: After reading again you definitely want the second option using dfid. But the first option is there for another time.