Discussions

Expand all | Collapse all

Can I create separate buttons to create records using the same form with different fields populated?

  • 1.  Can I create separate buttons to create records using the same form with different fields populated?

    Posted 11-28-2017 19:07
    We have several types of records that get created with the same form and are all in the same table.  So for example I want one button which says 'create new health record' which will have 10 fields pre-populated and another button which says 'create new financial record' which will have the same 10 fields pre-populated with different data ... etc with up to 10 or more 'create' buttons.  Thanks.


  • 2.  RE: Can I create separate buttons to create records using the same form with different fields populated?

    Posted 11-28-2017 19:30
    If you look at the Add new child record button that gets generated on the child table after creating a table relationship you'll see the code it's using which basically create a new record in that child table and add the master tabls RecordID value to a numeric field in the child table. You can just copy/paste the &_fid_123="some value" and it will add that value to the field with ID of 123. Repeat for as many fields as you want to populate. then save all that code and make another button with the values for the health, then repeat for financial and so on. 

    Personally I would script this and create a config object with the parameters of each button then javascript to handle the add record calls. Hope that helps. Good luck! Welcome to reach out directly if you need help. earn.com/chuck


  • 3.  RE: Can I create separate buttons to create records using the same form with different fields populated?

    Posted 11-28-2017 19:54
    As a tip, I find it easier to manage these buttons when they're structured w/ one field per line, like so:
    URLRoot() & "db/" & [_DBID_HERE] & "?a=API_GenAddRecordForm" &
    "&_fid_23=" & URLEncode ([field value]) &
    "&_fid_18=" & URLEncode ("value") &
    "&z=" & Rurl()