Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

scriptcase javascript close modal form

SCRIPTCASE close modal form

I’d try this.

Create a JS function in the app OnLoad event:

echo "<script>
function close_modal()
{
window.parent.tb_remove();
}
</script>
";
In the ajax button code, trigger the close_modal function via the sc_ajax_javascript macro:

sc_ajax_javascript('close_modal'); 
NOTES

The JS function could be implemented as an external library so that you have a centralized version to manage in case you need to edit it; being a one line function, I don’t know if it’s worh the effort.

SC has also other ways to create JS functions inside individual form apps: “Form Settings  JavaScript” or “Programming  JavaScript Methods” but usually I don’t use them so I don’t know if the above suggestion would work.
Comment

PREVIOUS NEXT
Code Example
Javascript :: detect paste in textarea 
Javascript :: submit file js 
Javascript :: await multiple promises 
Javascript :: Use Set to ensure the uniqueness of a list of values javascript 
Javascript :: flutter enum to json 
Javascript :: npx create-next-app permission denied 
Javascript :: uplaod file in s3 from heroku for node js 
Javascript :: SHOPIFY CUSTOMER WITHOUT REGISTRATION 
Javascript :: what is fn extend 
Javascript :: javascript test https 
Javascript :: npm password validator 
Javascript :: check for changes in other store NUXT JS 
Javascript :: create multidimensional array with foreach javascript 
Javascript :: &amp;&amp; in react jsx 
Javascript :: how to create a tag object in jQuery 
Javascript :: Check if something is a function 
Javascript :: Using JSON As Parameter 
Javascript :: JavaScript combining rows of multiple datasets 
Javascript :: multiple images gallery after clicking image javascript 
Javascript :: converting JSON to jsObject 
Javascript :: Example Of _.extend 
Javascript :: Add Click events to multiple classes. 
Javascript :: asp.net updatepanel autoscroll fix 
Javascript :: Listen to custom event in Vue.js 
Javascript :: dropdown list trigger change with value jquery 
Javascript :: ajax file upload 
Javascript :: node js swear filter 
Javascript :: javascript interview questions geeksforgeeks 
Javascript :: difference between usecallback and usememo 
Javascript :: javascript coding problems 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =