Forum Discussion

StephenStephen's avatar
StephenStephen
Qrew Assistant Captain
8 years ago

Button to check a field and save the record (Submit button)

I want to put a "submit" button on my form that allows for:
1. A checkbox field to be checked [Invoice Submitted]
2. The record to be saved
3. It must work whether or not it's a new record or one that has been saved before.
4. I was using a formula-text  but formula-URL is fine that that's what I should be doing.

I was trying to get it to update the field and save the record, but the code doesn't work, I believe because it has to be saved first

var text Update=URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_20=1"& "&apptoken= *********";  "<a id='saveButton' class='Vibrant Success' onclick='DoSaveAdd()' href='#'>Submit Invoice</a>"

21 Replies

  • This is the only school there is for the type of questions you are asking.  There are a bunch of tricks to learn.  Once you learn them, you just keep re-using them.
    • StephenStephen's avatar
      StephenStephen
      Qrew Assistant Captain
      Well you'd think I could at least have realized that I declared a variable and then never called it. :(
    • StephenStephen's avatar
      StephenStephen
      Qrew Assistant Captain
      I did add to my report as well, and presto, like magic.
  • StephenStephen's avatar
    StephenStephen
    Qrew Assistant Captain
    This is excellent. Thanks. I had to remove what appeared to be a stray "=" in the first assignment so it now looks like this. And yes, a green button was mandatory for this one :)

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


    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);
  • It even works if it was a button on an embedded report  of records on a record.  ie on a child table on a report on a record.
  • btw, what is your "day job" in real life?  What kind of business are you running?