Discussions

 View Only
  • 1.  Help with URL Button to Trigger Checkbox & Dynamic Rules

    Posted 08-03-2021 17:01
    Hi,

    I'm trying to make a fancy "to-do" list (simplified for sake of discussion) and have hit a snag.

    I had set up some Dynamic Rules to have a Checkbox log a Date/Time field to the current timestamp.
    This works only in "Edit" mode of a form.

    I wanted this to be easier on the user and tried using a URL Button that when clicked (in View mode) would check the Checkbox field for them. However, when this happens, it doesn't look like it's triggering the Dynamic Form rule of also logging the timestamp.


    var text AffectedCheckbox = "&_fid_195";

    var text URL= URLRoot() & "db/" & Dbid() & "?act=API_EditRecord"
    & "&rid=" & URLEncode ([Record ID#])
    & $AffectedCheckbox & "=1"
    & "&apptoken=" & "(my app token)";

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

    Also, I read that javascript reload isn't good as QB will remove it for security reasons later on in the year, but I wasn't able to find an alternative that worked in these discussions.

    Thank you for any help.



    ------------------------------
    Brian
    ------------------------------


  • 2.  RE: Help with URL Button to Trigger Checkbox & Dynamic Rules

    Posted 08-03-2021 17:14
    Dynamic form rules will only kick in when a human user is editing a record in the browser.  The form rules run on the browser.  Try this code. Change the 999 to the fid of the date time field.


    var text URL= URLRoot() & "db/" & Dbid() & "?act=API_EditRecord"
    & "&rid=" & URLEncode ([Record ID#])
    & "&_fid_195=1"
    & "&_fid_999=now"
    & "&apptoken=" & "(my app token)";

    var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

    $URL
    & "&rdr=" & URLEncode($RefreshPage)


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



  • 3.  RE: Help with URL Button to Trigger Checkbox & Dynamic Rules

    Posted 08-03-2021 17:33
    Thanks Mark for the quick response.
    I was afraid that Dynamic form rules would only apply when manually editing the form.

    I am also using Dynamic form rules when the checkbox is checked to show a different section.
    Do you know how I'd go about that?

    ------------------------------
    Brian T
    ------------------------------



  • 4.  RE: Help with URL Button to Trigger Checkbox & Dynamic Rules

    Posted 08-03-2021 17:41
    Sorry,

    I may have missed lead you with my response. Dynamic for rules also work in view mode so if you push a button in view mode which edits the record and then re-displays the record than the dynamic form rules will show / hide based on whatever the rules say.

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