Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
6 years ago

URL code help

Hi,

I am very new to URL coding, and everything I have done so far is copy paste from what I find (usually some code Kirk has made). I found two bits of code I would like to combine, but am not sure how to go about doing it.

The first bit of code is to toggle a checkbox on and off.

The second bid of code is a pop up that states "Email has been sent." I was hoping I could just add the second bit of code after the first, but I wasn't that lucky. Is it possible to combine?

Thank you.

If([Checkbox] = false, URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &
"&_fid_101=1" &
"&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() &
"?a=dr&rid=" & [Record ID#]),

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &
"&_fid_101=0" &
"&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() &
"?a=dr&rid=" & [Record ID#]))

2nd code I would like to add on

"javascript:" &

"$.get('" &

$url &

"',function(){" &

"$.jGrowl('Email has been sent', {life: 5000, theme: 'jGrowl-green'});" &

"});" &

"void(0);"



------------------------------
Mike Tamoush
------------------------------
  • Try this
    var bool NewToggle = not [The name of your checkbox field];

    var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord"
    "&rid=" & [Record ID#]
    "&apptoken=d9eascudwjxs2sesxkjccwgtq9r"
    "&_fid_101=" & $NewToggle;

    "javascript:" &
    "$.get('" &
    $url &
    "',function(){" &
    "$.jGrowl('Email has been sent', {life: 5000, theme: 'jGrowl-green'});" &
    "});" &
    "void(0);"

     


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------
    • MichaelTamoush's avatar
      MichaelTamoush
      Qrew Captain
      Mark, 

      I don't get any error messages, and it gives me the 'email sent' message, but it doesn't toggle my checkbox. I'm not sure why? I don't know a lot about app tokens, I just am going to my settings and coping and pasting. Perhaps there is more I need to do there?

      ------------------------------
      Mike Tamoush
      ------------------------------
      • LauraThacker's avatar
        LauraThacker
        Qrew Captain
        Can you:

        1. triple-check that FID 101 is a regular checkbox (and not a formula)
        2. create a new apptoken, and substitute the new one for the old one in your formula
        3. check the key field of your table is [Record ID#] and not some other key value instead (if you have chosen another key value; then use &key=" & [Key Field]
        4. try removing the redirect; and see if you get the XML response that shows you have made an update or have not made an update

        ------------------------------
        Laura Thacker (IDS)
        laura@intelligentdbs.com
        (626) 771 0454
        ------------------------------