JasonJohnson
7 years agoQrew Assistant Captain
How do I Edit a form and click on a button to perform API command(s) WITHOUT saving before clicking on the button?
I use Rich Text formula buttons and the code for returning to the same location the button was used for returning to where the button was pressed. Like below
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> Start Configuration </a>"
But when used on a form if you have edited you have to save then click on the button. I found this string of code
onclick='saveButton.click();'
Then placed the code in the button like below and it saves and executes the API commands that I use in the $URL .
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"onclick='saveButton.click();'> Start Configuration </a>"
On a side note I got into the habit of using the Rich Text Formula instead of the standard URL for buttons to mouse over coloring and to dynamically name buttons. Such as having a check in button for technicians but using the technician name in the button. This code did present a small issue that I used a variable to resolve. Example below.
var text lead = [Technician Name];
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"onclick='saveButton.click();'><center> Check In <br> "& $lead &"</center> </a>"
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> Start Configuration </a>"
But when used on a form if you have edited you have to save then click on the button. I found this string of code
onclick='saveButton.click();'
Then placed the code in the button like below and it saves and executes the API commands that I use in the $URL .
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"onclick='saveButton.click();'> Start Configuration </a>"
On a side note I got into the habit of using the Rich Text Formula instead of the standard URL for buttons to mouse over coloring and to dynamically name buttons. Such as having a check in button for technicians but using the technician name in the button. This code did present a small issue that I used a variable to resolve. Example below.
var text lead = [Technician Name];
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"onclick='saveButton.click();'><center> Check In <br> "& $lead &"</center> </a>"