Skip to main content
Question

Converting Buttons to Rich Text for Mobile

  • December 1, 2020
  • 0 replies
  • 99 views

I have several buttons that are currently formula URL buttons and I need to convert them to Formula Rich Text buttons because they do not work on mobile.  The code works api_editrecord works the only issue is that it does not save the form before running the api_editrecord. How do I get the rich text button to save before running the api_editrecord.

If([Daily Pilot Log Status]="Submitted-Pending Vendor Approval",

var text URL = URLRoot() & "db/" & [_DBID_DAILY_PILOT_LOGS] & "?a=API_EditRecord&rid="&[Record ID#]
& "&_fid_150=" & URLEncode("Approved")
& "&_fid_152=" & Now()
& "&_fid_151=" & URLEncode(User());

var text rdr = URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=3";
"<a style='width: 150px;border-color:black; font: Arial; text-decoration: none; background:#37a237;color:white;' class='btn btn-sm btn-primary' href='#'" &
"onclick= \"window.location.replace('" & $URL & "&rdr=" & URLEncode($rdr) & "');\"" &
">Approve</a>")

​

------------------------------
C G
------------------------------
This topic has been closed for replies.

  • Quickbase Staff
  • December 2, 2020
Christopher: 

You can do this with a Formula URL and if I read your question right, if you want the page to be saved before doing the API_EditRecord, you could do it with javascript but let's try it with a Formula URL that doesn't require javascript.

You will want to turn on: Learn more located under App Properties.  Also, only a Formula URL field will save the parent record whilst you navigate away from a changed record.  It won't save the record if you use a formula rich text field.  Also, even if you use a formula url field, and you are on a parent record and nothing has changed on that record, you will be redirected to your rdr= url but the form doesn't see any changes so it will redirect without saving. (just a few learned lessons).

You will want to create a formula url field and use the following:

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=cpaz2k7njc4ifc24muhvc749ast&rid="&[Record ID#]
& "&_fid_102=" & URLEncode("Approved")
& "&_fid_103=" & Now()
& "&_fid_105=" & URLEncode(User())&
"&rdr="&URLEncode(URLRoot()&"db/"&Dbid() & "?a=dbpage&pageID=33")

See video:
https://drive.google.com/file/d/18luV8HqzNDoWwI2Qh7JcP-h32OC6uy-1/view?usp=drivesdk

There is another way of doing this by invoking an onload to override the QuickBase redirect url but you already can use rdr= like the formula above.  Also QuickBase is migrating away the use of javascript in the buttons so I'm trying to honor that with a non-javascript option whenever possible.   You are welcome to comment and let your feeling be known at http://quickbase.uservoice.com.

We talk about things like this during our daily M-F webinars "Office Hours" held at 1pm Eastern time.

Hope that helps.

Kirk

------------------------------
Kirk Trachy , Senior Solutions Consultant
QuickBase | 603-674-5454 M | ktrachy@quickbase.com
------------------------------