Button to update field on current form

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

I'm trying to have a button at the top of an add record form that when pressed will update a field (or maybe multiple fields) on that form.  Since the form is used in "Add" mode, I don't have a record ID yet.  

I just need to press the button and then FID#18 changes to "abc" and hopefully be able to do this without needing to save or redirect the record.  

I feel like this is a stupid question but I just can't figure it out. Forgive me :)

Photo of Andy

Andy

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Can you provide a bit more context on the need you're trying to solve for?
You are correct that if you don't have a record ID# yet, you cannot actually edit the record.  If this was being launched off a Parent record, then its easy to modify the URL to pre-populate some fields.

But it sounds like you are not adding a child off a Parent.

What I suggest is that you simply make a Special  Add button and put it on the form.  You would use the API_AddRecord to do this.

So what would happen is that the user will click the regular Add Record button.  Then if the user realizes immediately that they want to use a standard template type Add Record with certain fields filled in, they would press the special Add Record button on the form.  If they are smart enough to do this immediately, then they will simply get a new add record form pop up in place of the empty form they had.  QuickBase should not interfere as the record has not been dirtied yet, ie no data entry yet.

If they are not smart enough, then when they click that button it will tell them they have unsaved changes and they will have the option to abandon those changes - which is what they should have done if they were smarter, to starts with a pre-populated form.

The typical format of an Add Record API would be

URLRoot() & "db/" & dbid() & "?act=API_AddRecord"
& "&_fid_6=" & Urlencode ("some text here")
& "&_fid_7=" & Urlencode ("some text here")
& "&_fid_8=" & Urlencode ("some text here")
Photo of Andy

Andy

  • 0 Points
I have a form with a field called Ticket Type with options to choose like Call, Email, Chat, Project, etc.  Instead of showing it as a dropdown or radio buttons on the form, they would like buttons at the top of the form.  When you click on the "Call" button, it will change the Ticket Type field to "Call", or click the "Chat" button to update the Ticket Type field to "Chat".
Does that help?
I don't see a way to do that with URL formula buttons.
Photo of Andy

Andy

  • 0 Points
What about doing the API_AddRecord action but then open the record in edit mode once it has been added?  So basically you click the Chat button, it performs the AddRecord API to update Ticket Type, and then redirects to the edit of that same record
When you use the AddRecord API, there is an suffix option on the API &disprec=1

In english that says "and once you have added the record,  Display record =true" which means land the user on the display mode of the record.

But there is no option to land the user in edit mode and not way to use &next URL to go into edit mode as we don't know the record ID#.

The can be done with javascript, no doubt, as it can wait for the API to respond with the record ID# and then use it.  But I'm more of a "low code / no code" kind of guy, so I don't really want to have apps use script for future maintenance support reasons.