clear a field when a Button is clicked

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

below is my current button formula, can I add after clicked clear a field

var text NewToggle = If([SEND_NOT]=true, "0","1"); 

var text URL=URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=cnfhq2kbqjb2edx6f7qwnu27xv&rid=" & [Record ID#] 

& "&_fid_208="&$NewToggle

& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);

If([Record ID#] > 0,

"<a style='text-decoration:none; font-weight:bold' class='Vibrant Primary' href='" & $URL & "'>SEND CUTSHEETS</a>" 

)

Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
I'm not sure what you're asking - can you rephrase the question?
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
I have a multi text field with various email address to send notifications, after the button "send email" is click can I add to the formula to clear the multi text field that I have the email addresses stored
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Typically, you can do another API call using another RDR in the formula before the RDR to display the record. I have not tested how this works with Text-Multi-select fields, but I would assume that it would work just as well.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,168 Points 50k badge 2x thumb
I don't think I have ever been able to successfully get the RDR to work unless it's used on a URL formula button. When it is used as a text formula field with HTML enabled, the RDR has never worked for me.
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
I've actually stopped using the Formula URL buttons except for the ones the app builds dynamically. Most of the time, when I was having issues building the Formula Text buttons, I had done something like not URLEncode'ing some text that had spaces in it or something weird like that.
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
If you want to check a box and then uncheck it in the same action, I would modify the formula as follows:

var text NewToggle = If([SEND_NOT]=true, "0","1"); 

"<a class=\"Tall Vibrant Primary\" & href=" &


URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=TOKEN&rid=" & [Record ID#] 

& "&_fid_208="&$NewToggle & "&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=TOKEN&rid=" & [Record ID#] 

& "&_fid_208="&$NewToggle & "&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))

& "'>SEND CUTSHEETS</a>"

Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
The formula is working, I just need to find a way to clear a field, I would like to clear the field on open
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,024 Points 20k badge 2x thumb
I like never use RDR unless I am invited to a 1995 QuickBase party in which case I spike the punch with <script>.
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
I used the formula and it didn't uncheck in the same action
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,168 Points 50k badge 2x thumb
Does it work as a pure URL formula button?

var text NewToggle = If([SEND_NOT]=true, "0","1");

var text URLONE=URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=cnfhq2kbqjb2edx6f7qwnu27xv&rid=" & [Record ID#] & "&_fid_208="&$NewToggle;

var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$URLONE
& "&rdr=" & URLEncode($URLTWO)
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
One thing I didn't think about, but should've...the problem would be with setting the var's value. The value is set at the time the button is clicked, so it will never change. So, if you want the button to check a box and then uncheck a box in the same formula, you would have to hard-code the value as 1 to check the box and 0 to uncheck the box, rather than using the var.