Close window on AfterInsert Event

Hi to all, What I need I supose is simple, but I could not figure out how.

I have a form, and I need to close the window on the AfterInsertEvent. I`ve been trying with sc_exit(), sc_exit(ok) but with no results.

Do you know how can I do that?

Re: Close window on AfterInsert Event

I forgot to say that I cannot use the options in Application -> Navigation, because I use this forms in many places and in the other ones it must not close…

Re: Close window on AfterInsert Event

Have you tried sc_redir(app.php);

Regards,
Scott.

Re: Close window on AfterInsert Event

Hi scott, I need “to close” the window, not redirect the app

Re: Close window on AfterInsert Event

Can you use: self.close() or window.close()

Regards,
Scott.

Re: Close window on AfterInsert Event

You can’t execute javascript in the before/after insert/update/delete events. You can echo the javascript code, but it is not executed. See also post http://www.scriptcase.net/forum_en_us/index.php?topic=1245.0

I’m afraid there’s not (a simple) solution for your problem.

Re: Close window on AfterInsert Event

I beg to differ with you.

I created a grid app using a sc_link to load an edit form in a new page using _blank.

Add the following code to the onAfterUpdate event and it closed the window after I updated:


echo "<script type="text/javascript">".
"window.close();".
"</script>";

Worked like I expected. Closed the page.

Regards,
Scott.

Re: Close window on AfterInsert Event

Scott, I put your piece of code in an onAfterUpdate of a simple form. When I press the Update button, then I get a message output window without any messages in it (because of the echo) instead of the window being closed.

You use a grid and sc_link to start the edit form. I just have a edit form. Does this cause the different behaviour? (doesn’t make sense to me…)

Re: Close window on AfterInsert Event

In another approach, I create a new LINK button on a grid form for the toolbar, linked it to another form that opens in a new window for an INSERT form and it behaved as expected. Form closed using same code in onAfterInsert.

What version of SC are you using? What is your browser?

I have SC5.002 and using FF3.5

Regards,
Scott.

Re: Close window on AfterInsert Event

SC 4.00.0035
FF3.5

Have you tried a single edit form without the grid?

Re: Close window on AfterInsert Event

Load an edit page from a menu item?

Re: Close window on AfterInsert Event

I just “run” the application from scriptcase.

Re: Close window on AfterInsert Event

Loaded SC
Loaded Form
Run
Clicked Update
Form gone.

Perhaps this is an issue with SC4?

Scott

Re: Close window on AfterInsert Event

I tried this on SC4 and I get the same result as you … an empty output box.
I would suggest getting your update to SC5 and you should be able to remove the alternative steps you are taking now in SC4.

Regards,
Scott.

Re: Close window on AfterInsert Event

okay thanks, I’ll try that.

Re: Close window on AfterInsert Event

ok, I havent upgrade to SC5 yet, I`ll try and post results.

Re: Close window on AfterInsert Event

do you need to pay to upgrade to V5???

Re: Close window on AfterInsert Event

This depends on the date your V4 license started. I don’t know what the exact criterium is, but I registered V4 a few months ago and I got the upgrade for free. Check the license department.

Re: Close window on AfterInsert Event

In V4 you must disable “Ajax” in the application settings.

V?tor Jamil