Forum Discussion

ChrisFaye1's avatar
ChrisFaye1
Qrew Cadet
5 years ago

Magic Button Question - Changing Appearance after clicking

Hi All, 

I have searched but can't seem to find this option. 

I have already created a formula url button that runs a few actions (checks a box, notes the user that clicked it, and refreshes the page). 

Is there a way to have the appearance of the button change whether it's been clicked or not (maybe using the checkbox I mentioned above)?

Example: Before button displays as green and text "Click to Approve" and after clicked display as red and text "Approved". 

The main issue I'm dealing with has to do with this button in reports. In the form view, I'm able to make it appear that it has changed by using two buttons and form rules, but this doesn't allow someone to know that the button on the record has already been clicked when clicking the button in report view. 

Any ideas?

Thank You!
Chris


------------------------------
Chris
------------------------------

13 Replies

  • You can do this with a Formula Rich text field,

    var text ToggleApproval  =
    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_28=" & not [checkbox];

    // note that you already have a formula URL field so you can just use this instead of the above line

    var text ToggleApproval = [my existing URL formula field];

    var text URL =
    "javascript:" &
    "$.get('" &
    $ToggleApproval &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);";

    If([checkbox]=true,

    "<a class=\"Vibrant Danger\"a href=" & $URL & ">" & "Click to reverse Approval" & "</a>",
    "<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'" & "a href=" & $URL & ">Click to Approve</a>")

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • ChrisFaye1's avatar
      ChrisFaye1
      Qrew Cadet
      Thank You, Mark! As always you're amazing!

      So would I'd be adding it into the formula button, right?

      Here's the current formula. Sorry I'm a little turned around on where to splice in the If statement.

      // edit the record: fid 109 to [Approved By] - Stamp application with approver name and date/time
      var text URLONE = URLRoot() & "db/" & Dbid()
      & "?act=API_EditRecord&rid=" & [Record ID#]
      & "&_fid_236=" & URLEncode(UserToName(User()))
      & "&_fid_237=true"
      & "&apptoken=.....";

      //Display Current Record
      var text DisplayRecord=
      URLRoot() & "db/" & Dbid()
      & "?a=dr&rid=" & [Record ID#]
      & "&apptoken=.....";

      //String, Edit and Display Current Original Record

      $URLONE
      & "&rdr=" & URLEncode($DisplayRecord)

      ------------------------------
      Chris
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        OK, it is helpful to see your code

        Try this
        // edit the record: fid 109 to [Approved By] - Stamp application with approver name and date/time
        var text URLONE = URLRoot() & "db/" & Dbid()
        & "?act=API_EditRecord&rid=" & [Record ID#]
        & "&_fid_236=" & URLEncode(UserToName(User()))
        & "&_fid_237=true"
        & "&apptoken=.....";


        var text URL =
        "javascript:" &
        "$.get('" &
        $URLONE &
        "',function(){" &
        "location.reload(true);" &
        "});"
        & "void(0);";

        If([checkbox]=true,

        "<a class='Vibrant Danger'>Approved</a>", 

        "<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'" & "a href=" & $URL & ">Click to Approve</a>")

        You can also substitute 'Vibrant Primary' for 'Vibrant Danger' if you want the button to be blue instead of red when approved.   Or 'Vibrant Alert" for a yellow color.


        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------