Skip to main content
Question

How to change Button Label

  • December 16, 2018
  • 0 replies
  • 104 views

I have an Action button that when clicked changes status.  Now, the button says "Action".  I would like to have a rule or function that would change the Button Label to something more meaningful... like "Change Status to Ordered" or "Change Status to 'In Warehouse'" based on the current status.

Any suggestions on the best way to do that?  Of course, I do not want to permanently change the label value, but have it be dynamic based on the data in the record.

Thanks,
Dean
This topic has been closed for replies.

Can you post your current code?

sure... I am using a variation of something you suggested in another post.  btw... the link works to change the data but I don't know how to use the $buttonLabel?

var text nextStatus = 
   Case( [Related status]
   ,13,"16"
   ,16,"14"
);

var text buttonLabel = 
   Case( [Related status]
   ,13,"Update Status 'In Warehouse'"
   ,16,"Update Status 'Ready For Pickup'"
); 


var text URL = URLRoot()
& "db/bn6bxjm9t?a=API_EditRecord&rid=" & [Record ID#]
& "&_fid_23="& $nextStatus  
& "&apptoken=dwnt9wipc3cvfcg6nvd3ba97ps4";


If($nextStatus > ""
   , "javascript:" &
      "$.get('" & 
      $URL & 
      "',function(){" &
      "location.reload(true);" &
      "});" 
      & "void(0);"
)

thanks for the help.

I suggest making a copy of the field and then changing the type to formula rich text.

The generic format for a hyperlink is this

" & $Words & ""

The Words can be divined as any text string including HTML or an image. So you can start low tech and make an html string for words

Start with this

var text Words =
Case( [Related status]
,13,"Update Status 'In Warehouse'"
,16,"Update Status 'Ready For Pickup'"
);

But you can add color and bonding and font sizes with basic html.

,13,"Update Status 'In Warehouse'"

If you want to put in more effort, you can also go to a site called

Dabuttonfactory.com

And create a custom image for a button.

There is probably a way to have a string of code which will actually create a button shape image and let you control the words but I don�t have the syntax available for that.

You can also use the stock images which Quick Base provides and combine yhem with Words.

I will post a link separately.

hmmm... how would that be integrated with button such that when the button is clicked it runs the api_editrecord?

Sorry , my post above got garbled by this forum. I will post back later today when I�m back on my computer.

OK, let try again,
The site did  not seem to allow me to put in extra spaces between the section of code.  ir after each semi colon.



var text Words = 
   Case( [Related status]
,13,"16"
   ,16,"14"
);
var text Words = 
   Case( [Related status]
   ,13,"<b><font size=+1>Update Status 'In Warehouse'"
   ,16,"<b><font size=+1>Update Status 'Ready For Pickup'"
); 
var text Update = URLRoot()
& "db/bn6bxjm9t?a=API_EditRecord&rid=" & [Record ID#]
& "&_fid_23="& $nextStatus  
& "&apptoken=dwnt9wipc3cvfcg6nvd3ba97ps4";
var text URL = 
    "javascript:" &
      "$.get('" & 
      $Update & 
      "',function(){" &
      "location.reload(true);" &
      "});" 
      & "void(0);";
IF($NextStatus<>"",
"<a href=" & $URL & ">" & $Words & "</a>"
)


should the field still be a formula url?  I am getting this now.

https://xx.quickbase.com/db/http:/<a href=javascript:$.get('https:/fixandpaint.quickbase.com/db/bn6bxjm9t?a=API_EditRecord&rid=15&_fid_23=16&apptoken=xxx',function(){location.reload(true);});void(0);><b><font size=+1>Update Status 'In Warehouse'</a>

The field type should be formula rich text.

nice.. now it works perfectly.... since I lost the button I will want to get an image like you were suggesting... thank you very much for all the help.  I do not think I could have figured it out.