Forum Discussion
- _anomDiebolt_Qrew EliteBefore I answer, I am curious to know what you put in the page close.html.
You should be using a pure script solution and calling QuickBase's API methods using AJAX without loading new pages and subsequently closing them. The response of most of the API methods in QuickBase's API are not intended to be displayed unless they return HTML (most API methods return XML). - RahulRahulQrew MemberThanks Dan. I kept below code in close.html to close the new window.
<html>
<head>
<SCRIPT language=JavaScript>
function closeit(){
window.close();
}
function refresh(){
opener.location.reload();
}
</SCRIPT>
</head>
<BODY onLoad="closeit()" onunload="refresh()">
</body>
</html> - RahulRahulQrew MemberDan, The above code is working fine and am able to delete the parent record but i also want to delete related child records. so is it possible to delete that by adding some extra piece of code?
and api_delete the records with parameter rid and unfortunately we are calling this button from parent table so we don't have that here. the only thing we have here is related record id, which is actually the key field of parent table.
so is there a way to get the rid of all child records those are related to parent record and then delete. - _anomDiebolt_Qrew Elite>The above code is working fine ...
Your are just making the job harder by using your current approach. You should put all your JavaScript code in a user defined page and invoke it with a button that uses $.getScript() to execute the JavaScript. This code should do the job:
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=460
I would test this in a separate application as both methods API_EditRecord and API_PurgeRecords will not ask for confirmation before deleting the parent / child records. You can of course add you own confirmation logic to the script.- NirajShah1Qrew CadetDan, I am unable to get this script to work for me. I am also trying to create a button which will delete the parent and all child records.
- RahulRahulQrew MemberThanks a ton Dan :+1:
I have implemented the code as you suggested and its working fine :smile: