Quick Base Discussions

Expand all | Collapse all

url formula javascript button issue

  • 1.  url formula javascript button issue

     
    Posted 02-10-2018 23:02
    I'm trying to create a button that when pressed executes a url formula javascript.

    My url formula [Welcome Email Trigger] works perfectly: 
    //
    var text URL = 
    URLRoot() & "db/"&[_DBID_xxxxxxx] & "?act=API_EditRecord&rid="&
    [Record ID#]& "&_fid_45=" & ToText(Now()) 
    & "&apptoken=xxxxxx";
     "javascript:" & "$.get('" & $URL & "',function(){" &"location.reload(true);" & "});"
    & "void(0);"
    //

    My button looks good: 
    //
    "<a class='Vibrant Success'style='border:1px solid #6BBD57; background-color:#6BBD57'><span class='ButtonText'>Send Welcome Email</span></a>"
    //

    ...but how do I combine these? I attempted to use the following with no luck: 
    //
    "<a href='[Welcome Email Trigger]' class='Vibrant Success'style='border:1px solid #6BBD57; background-color:#6BBD57'><span class='ButtonText'>Send New User Welcome Email</span></a>


  • 2.  RE: url formula javascript button issue

    Posted 02-10-2018 23:17
    Howdy

    // Create a URL (Formula) field in the form, then edit properties of the field to:
    // Link Text "Send Welcome Email"
    // Option check box to tick for "Display as a button on forms and reports
    // Click the choose button color box and in the # at the bottom of the configure screen input "6BBD57"
    //Input the below into the formula field
    var text URL = URLRoot() & "db/" & [_DBID_xxxxxxx] & "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_45=" & ToText(Now()) & "&apptoken=xxxxxx";
    "javascript:" &
    "$.get('" &
    $URL &
      "',function(){" &
      "location.reload(true);" &
      "});" &
      "void(0);"


  • 3.  RE: url formula javascript button issue

     
    Posted 02-11-2018 15:41
    perfect- thanks!