Forum Discussion
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
https://resources.quickbase.com/db/bq8kmgrcq
Then click on the examples. The second example is titled : Add Child in Popup w/ Auto Close on Save - Rich Text
It gives you a code page, and then a NextURL statement to call that code page. Admittedly, I haven't tried it, but I told myself I need to experiment with that as soon as I have the need again!
To me, this solution only will work in instances where &NextURL will work. I know NextURL works in conjuction with the add record api, but not sure about edit record?
------------------------------
Mike Tamoush
------------------------------
- GeorgeBramhall23 years agoQrew CadetOk I built the close window page per the site you shared.
but
I get this error
<qdbapi><action>API_EditRecord</action><errcode>0</errcode><errtext>No error</errtext><rid>7484</rid><num_fields_changed>1</num_fields_changed><update_id>1645809864144</update_id></qdbapi>
...when I click the rich text button with this code:
var text Update = URLRoot() &"db/" & Dbid() & "?act=API_EditRecord"& "&rid=" & [Record ID#]
& "&_fid_1046=1";
var text RefreshPage = "&NextURL=" & URLEncode(URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=21&z=");
"<a class='Vibrant Danger OpenAspopup' href='" & If([Ready for Dispositions]=false,$Update
& $RefreshPage)& "' data-height=500 data-width=500 data-refresh=true title='Clicking this button will open a popup'>Confirm EM/DD Removal</a>"
and pop doesn't close.
Any ideas?
------------------------------
George Bramhall
------------------------------- MikeTamoush3 years agoQrew Commander
Technically as it says there is 'no error' which likely just means the redirect (close pop up) is not working. My guess is you have pageid 21 in your code. That is the page id from the sample code.
Be sure that matches what your actual code page id is. Hopefully that will fix it. Like I said, I haven't actually tested this myself so I can't confirm it even works, but it looks promising. Let me know if fixing the code page works!
Oh, also I dont think you need the &z= at the end. The sample shows it ending after the 21 (or your code page number)
------------------------------
Mike Tamoush
------------------------------
- GeorgeBramhall23 years agoQrew CadetCoincidentally my page is also #21.
...got rid of the &z= ... but alas, same error.
------------------------------
George Bramhall
------------------------------- MikeTamoush3 years agoQrew CommanderHmm. Ill try to test sometime. The only other thing I can think of is, maybe NextURL doesnt work with the Edit Record API?
Perhaps try NextURL with a simple redirect to anywhere (the record?) just to test if the next URL redirect is working.
------------------------------
Mike Tamoush
------------------------------
- GeorgeBramhall23 years agoQrew CadetThis code does it all in one shot (creates pop, checks box and then closes the window). However I want to have the user manually check the box on the pop up form (giving the user a moment to think about what they are about to do) and then save the record and have the pop up close.
var text url = URLRoot() &"db/" & Dbid() & "?act=API_EditRecord"& "&rid=" & [Record ID#]
& "&_fid_1046=1"&
"&rdr=" & URLEncode(URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=21") ; // Open code page 21 to close the popup
// data-height/width dictate the size of the popup
// data-refresh refreshes the source page once the popup is closed
// title provides the tooltip
If([Ready for Dispositions]=false,"<a class='Vibrant Danger OpenAsPopup' href='" & $url & "' data-height=500 data-width=500 data-refresh=true title='Clicking this button will open a popup'>Remove</a>")
------------------------------
George Bramhall
------------------------------- MarkShnier__You3 years agoQrew LegendTry this for us :)
var text url = URLRoot() &"db/" & Dbid() & "?a=er"& "&rid=" & [Record ID#]
& "&_fid_1046=1"&
"&NextURL=" & URLEncode(URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=21") ; // Open code page 21 to close the popup
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------ - MikeTamoush3 years agoQrew CommanderI didn't set up a code page, but quickly tested Marks suggestions. I think that should work, it certainly appears the NextURL is firing.
Also, I didnt know about the title CSS so I can hover and see a message on a button. I'm going to use that!
------------------------------
Mike Tamoush
------------------------------- MikeTamoush3 years agoQrew CommanderDang. I just tested. Works like a charm with the add record api. But I also cant get it to work with any type of edit. Not sure why....
------------------------------
Mike Tamoush
------------------------------
- GeorgeBramhall23 years agoQrew CadetThis is the code I originally had. It never closes the Popup. It leaves me with the pop open and at the point where I started but within the popup.
------------------------------
George Bramhall
------------------------------- EvanMartinez3 years agoQuickbase StaffHi George,
The example you are probably looking for is actually also in that code page sample app under the option for Prompt for Input and Refresh or Prompt for Input and Redirect. It is a bit more complicated but it pops up on a window from the form, gathers info from the user, and then refreshes the record it launched from and closes. You would need to tinker it to tailor it to your specific use case but that should be the general structure.
------------------------------
Evan Martinez
------------------------------ - MarkShnier__You3 years agoQrew LegendII had not looked at those code page examples in a while. This work for me to open a record in edit mode and upon save it close the pop-up.
URLRoot() &"db/" & Dbid() & "?a=er"& "&rid=" & [Record ID#]
& "&NextURL=" & URLEncode(URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=11")
But this did not refresh the original page. I'm not sure if you need that to happen but there seem to be other examples that would refresh the page.
Page 11 was the code page example here
CloseWindow.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script>
window.close();
</script>
<body>
</body>
</html>
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------- MikeTamoush3 years agoQrew Commander
Mark,
That also worked for me. But I discovered something (why I thought it didn't work for me before). This seems to only work when triggered from the record itself (meaning, when you are in the record on the form).
I tried it from the table view (the button was one of my columns) and interestingly, it does not work when the button is pushed from a report.
Also, regarding auto refresh - in my testing it DOES auto refresh if the button is Formula Rich Text, but interestingly does NOT auto-refresh if the button is formula URL.
------------------------------
Mike Tamoush
------------------------------