Forum Discussion

MattMakris's avatar
MattMakris
Qrew Assistant Captain
4 years ago

Re: Working Copy to Clipboard Button

I'm getting an error about it having javascript:

Only text, Quickbase-accepted functions, fields, variables, and certain HTML tags are allowed in this field. JavaScript is not supported.

Is there a workaround?

------------------------------
Matt Makris
------------------------------

6 Replies

  • SamanthaSand's avatar
    SamanthaSand
    Qrew Member
    In August 2021 QB stopped allowing "unsupported content" like javascript, presumably for security reasons. Existing javascript still works, but for any new formulas it won't let you save it.

    I found this really helpful when I needed to recreate a button action without javascript:

    https://community.quickbase.com/browse/blogs/blogviewer?BlogKey=3c579955-8f4f-40ed-89a3-ed5172a977e8&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804

    Happy to share my code with you if that helps. It's not a button that copies to the clipboard though. It changes the values of two fields in a record.

    ------------------------------
    Samantha Sand
    ------------------------------
  • SamanthaSand's avatar
    SamanthaSand
    Qrew Member
    Mark, here's the new code I wrote to replace javascript. It's meant to be used as a button in a report to mark a record as "reviewed" with the username and date/time recorded.

    var text name = "&_FID_12=";    //FID for a user field I want to change
    var text stamp = "&_FID_13=";    //FID for a date field I want to change
    var text tk = "cm7ucz6d2iyh6db4exfkbpzgsyx";         //Apptoken for my application
    var text return = "&rdr=' + escape(window.location); return false;});";
    
        URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=" & $tk & "&rid=" & [Record ID#] &
        $name & ToText(User()) &
        "&rdr=" &
            
            URLEncode(URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=" & $tk & "&rid=" & [Record ID#] &
                $stamp & Today() &
                "&rdr=" &
                    URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl()
            ))​


    ------------------------------
    Samantha Sand
    ------------------------------