How do you make a forumula text button in order to navigate to another form with the same record.

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

I know how to do it with a Formula Url but I wanted to use graphics in the button so I think it needs to be a formula text field???

Photo of Michael Graham | Insight Global UK

Posted 3 years ago

  • 0
  • 1
Here is an example of a formula text field with HTML enabled


var text URL = URLRoot() & "db/" & [_DBID_PRE_RECEIPTS_HISTORY] &
"?a=q&qid=14&nv=1&v0=" & [Product Line Code];

var text Image = "<img src=https://images.quickbase.com/si/24/123-graph_2d.png>";

"<a href=" & $URL &">" & $Image & "</a>"
Cool thats great, I just used the same code from the formula url from URLRoot etc.

var text URL = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & ToText([Record ID#]) & "&dfid=11" ;
var text Image = "<img src=https://images.quickbase.com/si/24/123-graph_2d.png>";
"<a href=" & $URL &">" & $Image & "</a>"

This is quite good for navigation.    thanks Mark
Photo of David

David

  • 836 Points 500 badge 2x thumb
Look for the Magic Buttons app in the app exchange: http://www.quickbase.com/exchange/magic-buttons-having-fun-with-formula/2660
Yes it helps to make the app more user friendly to add some colour.
Photo of Sarah

Sarah

  • 10 Points
Hi Mark, I am trying to do something very similar and I tried the formula suggested but it did not work. I have the following text formula and I would like to add an image so the users would click on the image rather than the URL.

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_60=0" & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr"& "&rid=" & URLEncode(ToText([Record ID#]))) & "&apptoken=y9b5tdcd7fz7pc5zz3pfctkpcq6"
I seem to recall in my testing that I was unable to combine the & "&rdr=" type redirects with an href web link.  I was not able to get it to be able to link showing formatted text or an image to kick off a URL which contained Redirects.
Photo of Sarah

Sarah

  • 10 Points
Do you think it will be possible to put the image in a text formula and the code in another text formula and create a third text formula with a rule to display the image field with the code from the code?
Sorry, I don't know how to make a URL formula with a "redirect" work with this technique.
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
@sarah: You will need to make 2 fields.  

One Formula-URL field with all the actions and redirects that you want, 
then a formula-text field with the following formula

"<a href='"&[URL Complete Mark AND Add Note]& "'><img height=\"23\" src=\"https://images.quickbase.com/si/24/226-rect_gray.png\"></a>"

That way you can use the graphic and have the formula being controlled by a different field.  You can also change the height (size) as needed.
Photo of QuickBasePros (Laura Thacker)

QuickBasePros (Laura Thacker), Champion

  • 5,466 Points 5k badge 2x thumb
Custom "button" Formula-Text Fields Formulas

For a custom-colored button that works in EDIT mode:


<a class='Vibrant Success' title='Save & Edit' style='text-align:center; text-decoration:none' onclick=\"LinkAway('" & 
URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xxxxxxxxxx&rid=" & URLEncode([Record ID#])
& "&rdr=" &
URLRoot() & "db/" & Dbid() & URLEncode("?a=er&rid=") & URLEncode([Record ID#])
& "', false)\""
& ">Save & Display</a>"

For a custom-colored button that works in VIEW mode:

var text url=URLRoot() & ..... (formula can include RDR) ;
(don't forget the variable needs a ; at the end)

"<a class='Vibrant Success' title='What the Button will Do' style='text-align:center; text-decoration:none' href=\"" &
  $url
  & "\""
  & ")'>Button Label Text Here</a>"


Note, the VIEW mode formula will NOT save any changes made on the Form from an EDIT mode Form Layout.