Discussions

 View Only
  • 1.  Magic Buttons - Click Graphic Control

    Posted 08-23-2021 12:40
    Hello,
    I am fairly new to quickbase so this might be an easy fix. I am following along with the magic button app and attempting to create my own progress bar that you can click to adjust the percentages. In the magic button app the field is called Press to Adjust % Completed. I copied the code and adjusted the field IDs and the app token but when I click on the bar I get redirected to this message:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <qdbapi>
    <action>API_EditRecord</action>
    <errcode>30</errcode>
    <errtext>No such record</errtext>
    <errdetail>Missing "rid" parameter.</errdetail>
    </qdbapi>

    I am not too familiar with HTML and don't know what that means.
    Here is my code for the press to adjust % completed field:

    var text redirect=URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl(); // REDIRECT TO THE DASHBOARD

    // THESE ARE THE IMAGES THAT ARE DISPLAYED. CHANGE THE GREEN AND GRAY TO OTHER GRAPHICS IF YOU WISH
    var text star = "<img" & " src=\"" & "https://images.quickbase.com/si/16/228-rect_green.png\">";
    var text notstar = "<img" & " src=\"" & "https://images.quickbase.com/si/16/226-rect_gray.png\">";
    var number numberstars = (Floor([% Project Completed] * 10));
    var number numbernotstars = 10 - $numberstars;
    //10 is the number of units, because 10 is 1/10th of 100.

    var text urlten =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord"
    &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=10";

    var text urltwenty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=20";

    var text urlthirty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=30";

    var text urlforty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=40";

    var text urlfifty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=50";

    var text urlsixty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=60";

    var text urlseventy =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=70";

    var text urleighty =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=80";

    var text urlninety =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_137=90";

    var text urlhundred =

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &
    "&_fid_28=Completed" &
    "&_fid_153=Completed" &
    "&_fid_137=100";

    "<span alt=\"" & ToText($numberstars) & " of 10 \" title='" & ToText($numberstars) & " of 10 ' class='NoWrap'>" &

    If($numberstars >= 1, "<a href=\""&$urlten&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlten&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 2, "<a href=\""&$urltwenty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urltwenty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 3, "<a href=\""&$urlthirty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlthirty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 4, "<a href=\""&$urlforty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlforty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 5, "<a href=\""&$urlfifty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlfifty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 6, "<a href=\""&$urlsixty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlsixty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 7, "<a href=\""&$urlseventy&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlseventy&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 8, "<a href=\""&$urleighty&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urleighty&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 9, "<a href=\""&$urlninety&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlninety&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    If($numberstars >= 10, "<a href=\""&$urlhundred&"&rdr="&URLEncode($redirect)&"\">"&$star&"</a>",
    "<a href=\""&$urlhundred&"&rdr="&URLEncode($redirect)&"\">"&$notstar&"</a>") &

    "</span>"


    Thank you in advance for the help!
    -Hank


    ------------------------------
    Hank Halverson
    ------------------------------


  • 2.  RE: Magic Buttons - Click Graphic Control

    Posted 08-23-2021 14:31
    My guess is that this button needs to only be shown in edit or add mode.  Adjust the form properties to only show the button in Edit or View mode.  If that does not fix the problem, please post back.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------