Forum Discussion
MarkShnier__You
Qrew Champion
Can you post your code for the cancel button?
Are you asking for the cancel button to work in Add Mode? Like a user would be adding a record in cancelled Status?
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
Are you asking for the cancel button to work in Add Mode? Like a user would be adding a record in cancelled Status?
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
ChrisSwirtz3
2 years agoQrew Member
Hey Mark,
This is the code to get the user to the "Cancel Form"
URLRoot() & "db/" & Dbid() & "?a=er&dfid=81&rid=" & [Record ID#]
And this is the code for the actual "Cancel" button on that form.
URLRoot() & "db/" & Dbid()
& "?a=API_EditRecord"
& "&rid=" & [Record ID#]
& "&_fid_1161=Cancelled"
& "&rdr="
& URLEncode(URLRoot() & "db/bsd4f85xs")
Which works perfectly when they are working with a record that has been saved and has a Record ID. However, when adding a new record, there is no Record ID established yet. Now, when I click on the button to navigate to the Cancel Form from a new unsaved record, it does save the record first because I have the setting turned on to do so, but when it opens the Cancel Form, it remains in "Add" mode and doesn't capture the Record ID that was created when it saved and navigated to the other form. It's almost as if the formula needs to save the record and reopen it as is then run the code to navigate away so the new form so it reads the Record ID at that point.
------------------------------
Chris Swirtz
------------------------------
This is the code to get the user to the "Cancel Form"
URLRoot() & "db/" & Dbid() & "?a=er&dfid=81&rid=" & [Record ID#]
And this is the code for the actual "Cancel" button on that form.
URLRoot() & "db/" & Dbid()
& "?a=API_EditRecord"
& "&rid=" & [Record ID#]
& "&_fid_1161=Cancelled"
& "&rdr="
& URLEncode(URLRoot() & "db/bsd4f85xs")
Which works perfectly when they are working with a record that has been saved and has a Record ID. However, when adding a new record, there is no Record ID established yet. Now, when I click on the button to navigate to the Cancel Form from a new unsaved record, it does save the record first because I have the setting turned on to do so, but when it opens the Cancel Form, it remains in "Add" mode and doesn't capture the Record ID that was created when it saved and navigated to the other form. It's almost as if the formula needs to save the record and reopen it as is then run the code to navigate away so the new form so it reads the Record ID at that point.
------------------------------
Chris Swirtz
------------------------------
- MarkShnier__You2 years agoQrew ChampionTry this for the Button to get to the cancel form. It should work in all modes, add, edit, view,
var text rid =
If([Record ID#]>0,
ToText([Record ID#]),
"%%rid%%");
var text url = URLRoot() & "db/" & Dbid() & "?a=er&dfid=81&rid=" & $rid;
"<a class='Vibrant Primary SaveBeforeNavigating' data-replaceRid=true href='" & $url & "'>Your button words go here like Cancel Form</a>"
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------- ChrisSwirtz32 years agoQrew MemberYour takes me to the Cancel Form no problem, but I get this error message when I click on the cancel button from the Cancel Form.
This XML file does not appear to have any style information associated with it. The document tree is shown below.<qdbapi><action>API_EditRecord</action><errcode>30</errcode><errtext>No such record</errtext><errdetail>Missing "rid" parameter.</errdetail></qdbapi>
The problem isn't getting to the Cancel form while in add mode. It is capturing that Record ID between so that theoretically when I get to the Cancel Form, it should be in edit mode of the Record that was just created. But that isn't what is happening, it's like it is saying that it is saving a record but then just reopening the add record screen in a different form.
------------------------------
Chris Swirtz
------------------------------- MarkShnier__You2 years agoQrew ChampionCan you post the code for the 1st button which has my suggested code?
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------