TylerBrezler
6 years agoQrew Cadet
API Edit call that also saves entered text and returns to edit mode at same spot in report
I have a Formula - URL / Formula - Rich Text (I've tried both) button that performs an API EditRecord which checks a box and records a single blank space in a text box (which is time-stamped, so it acts as a log).
I want the user to be able to enter a comment in a separate multi-line text field, then click the button that performs the API Edit. I want the end result to be that the user-entered comment is saved, the two edits are performed, and it returns the user to the form page, in edit mode, without losing their spot within the report (the Prev and Next buttons still appears in the top right).
I've tried to implement this a few ways. I have tried:
var text Submit = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] &
"&apptoken=XXXXXXXXXXXXXXXX" &
"&_fid_67= " &
"&_fid_61=True";
"<a class='Vibrant Danger'; onclick=$('#SaveAndKeepWorkingMenuOption').click(); href='" & $Submit &"'>Submit & Keep Working</a>"
But that method does not preform the proper redirect. It just takes me to the XML result page.
I have tried appending:
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"
But the problem with that is that the API Edit call and the text entered by the user seem to "fight" each other, and Quick Base throws up an error screen saying that you are trying to enter two pieces of data at the same time - which one do you want to save?
I have also tried:
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] &
"&apptoken=XXXXXXXXXXXXXXXX" &
"&_fid_67= " &
"&_fid_61=True";
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#])
This returns me to the edit screen but it loses my place in the report, and the Prev / Next buttons disappear.
I have the Save and Keep Working button checked on the form, and I have the "Save parent record automatically when a child record is created" option checked in the Advanced Settings for the table.
I want the user to be able to enter a comment in a separate multi-line text field, then click the button that performs the API Edit. I want the end result to be that the user-entered comment is saved, the two edits are performed, and it returns the user to the form page, in edit mode, without losing their spot within the report (the Prev and Next buttons still appears in the top right).
I've tried to implement this a few ways. I have tried:
var text Submit = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] &
"&apptoken=XXXXXXXXXXXXXXXX" &
"&_fid_67= " &
"&_fid_61=True";
"<a class='Vibrant Danger'; onclick=$('#SaveAndKeepWorkingMenuOption').click(); href='" & $Submit &"'>Submit & Keep Working</a>"
But that method does not preform the proper redirect. It just takes me to the XML result page.
I have tried appending:
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"
But the problem with that is that the API Edit call and the text entered by the user seem to "fight" each other, and Quick Base throws up an error screen saying that you are trying to enter two pieces of data at the same time - which one do you want to save?
I have also tried:
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] &
"&apptoken=XXXXXXXXXXXXXXXX" &
"&_fid_67= " &
"&_fid_61=True";
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#])
This returns me to the edit screen but it loses my place in the report, and the Prev / Next buttons disappear.
I have the Save and Keep Working button checked on the form, and I have the "Save parent record automatically when a child record is created" option checked in the Advanced Settings for the table.