Forum Discussion

Chris_MCDChris_'s avatar
Chris_MCDChris_
Qrew Member
11 years ago

Is there a way to add a button to a record that will cause a change to be made to the record when clicked?

I was wondering if there was a way to add a button to a record that when clicked would change a field in that record without having to go into edit mode?

For instance, I what to be able to change the status of a record from "On Hand" to "Retired" but just clicking on a button that is available from the report view. The reason this would be helpful is that if I am looking at a list of records that need to be retired, I now I could click grid edit and just change the status dropdown and then fill down, but I am trying to make the process as streamlined and simple for machine operators on the floor to do the updates.

24 Replies

  • You are probably missing the application token. Be that as it may be, the only JavaScript you should put into a QuickBase formula is a $.getScript() call and place all of your functional JavaScript in a user defined page. module.js. You are just asking for trouble writing JavaScript in a formula as there will constantly be character escaping issues Moreover, even if you only want your JavaScript to run on a button click you should use the image onload technique and put an event handler in the user defined page module.js rather than jam a callback or or an inline onload handler in your formula.
  • sorry Chris,

    just updated my formula above
    var text URL = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&_fid_9=1&rid=" & [Record ID#];
  • I am now getting this error,

    Formula syntax error

    A variable declaration must end with a semi-colon.



    var text URL = URLRoot() & "db/" & dbid()   "?act=API_EditRecord&_fid_9=1&rid=" & [Record ID#];

     "javascript:" &
     "$.get('" &
     $url &
     "',function(){" &
     "$.jGrowl('This Task has been completed', {life: 5000, theme: 'jGrowl-green'});" &
     "});" &
     "void(0);"
  • var text URL = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&_fid_9=1&rid=" & [Record ID#];
  • Ok, I think I got it now. But let me ask you this... in testing this out, I have clicked the button, and then went into the record to make sure it worked, and the first time it did. But then once I have changed it back and then tried it again, it no longer worked. Why is that? I still worked on a different record when I tried it on that one.
  • It should work consistently every time.  No way it would not work for a simply update like that.  Please test again.
  • I have actually tried it 3 times now, twice with my companies system an another with the other company I work with. It seems as though once you change a record using the button, then update that record back to its original state, when you go through the process again, the button no longer works on that record. Something must change about it. I don't see this really being an issue as once the button is used on a record, there really is no reason to change it back in most cases. I was just simply testing it out.
  • maybe make this minor chnage
    var text URL = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&_fid_9=1&rid=" & totext([Record ID#]);
  • Try Plan B: script using the image onload technique. It always works the first time!