rabbtux
Posts: 5
|
| Posted: 11/04/2008, 12:35 PM |
|
Hi all,
This is probably a simple question, but I can't seem to search the form for the right terms...
I've mastered getting a popup window from a link on a data grid. How do I get the window to dissappear after the user makes edits in this window and hits submit??
I know its probably a javascript line in the 'onclick' event, but cant find any examples.
Thanks in advance.
marshall
|
 |
 |
melvyn
Posts: 333
|
| Posted: 11/04/2008, 2:42 PM |
|
My cousin google says: http://www.google.com.do/search?q=javascript+window.clo...8&oe=utf-8&aq=t
Simple javascript.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
datadoit
|
| Posted: 11/04/2008, 6:42 PM |
|
Also check into the CCS Example packs. Somewhere in there is a popup
example that has a Close link.
|
|
|
 |
jjrjr1
Posts: 942
|
| Posted: 11/05/2008, 4:00 AM |
|
Hi
The trouble with using onclick event is if your popup is a CCS form with data update etc., your PHP functions such as updating the database will not occur if you use a window.close() function.
What I suggest is setting the return page for your submit, add, delete, functions to be another CCS page. Call It maybe close_window.
In the onload client event place
window.close();
This might work better.
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/05/2008, 4:04 AM |
|
BTW
Just for your info. If you just want to make a link that closes a pop up window all you have to do is create a link in CCS on the page and set the href or static link value to
javascript:window.close()
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
rabbtux
Posts: 5
|
| Posted: 11/05/2008, 6:46 AM |
|
Yes, I'm looking to have the popup window update a database record. Not looking for a another link to close window.
J.R. suggested to do a window.close() for the popup onload event. Not sure what you mean for popup to return to another css page? can't I just return to any page since the window will close? will test later today and report back.
Thanks
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/05/2008, 11:59 AM |
|
You misunderstand.
If you are doing database updates in your popup window, I assume the popup is a CCS project page correct?
If that is the case when you create that page you can set the return page for each submit button.
IE: submit, add, delete, cancel all have a attribute for return page.
Simply set that retrun page to another CCS page. call it window_close and in the onload client event for that page do window.close();
What will happen is after whatever submit button you click on the page in your popup window it will re-direct to close_window.php where the only thing that happens is the window gets closed.
Does that make sense?
Have Fun..
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/05/2008, 12:03 PM |
|
Another solution is do it in AJAX.
That way you never leave the page and no pop up is required.
There are samples of that also in the CCS example pack
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
rabbtux
Posts: 5
|
| Posted: 11/06/2008, 8:31 AM |
|
Quote jjrjr1:
You misunderstand.
If you are doing database updates in your popup window, I assume the popup is a CCS project page correct?
If that is the case when you create that page you can set the return page for each submit button.
IE: submit, add, delete, cancel all have a attribute for return page.
Simply set that retrun page to another CCS page. call it window_close and in the onload client event for that page do window.close();
What will happen is after whatever submit button you click on the page in your popup window it will re-direct to close_window.php where the only thing that happens is the window gets closed.
Does that make sense?
Have Fun..
Great, thanks! Now one small wrinkle.
How can I get this submit button to not only close the current popup window, but also force a reload of the original 'parent' page so that new changes are properly displayed?? Hopefully this isn't too difficult, and would result in a better client project!
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/06/2008, 8:49 AM |
|
Hi Rabbtux
Try this in the onload event for your window close page instead of window.close()
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
This works when closing a pop up initially. Not sure if it will work on a second called page.
Also maybe try this.
opener.location.reload(true);
self.close();
Let me know if this does work for you. I will be curious to know
Have Fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
rabbtux
Posts: 5
|
| Posted: 11/06/2008, 9:56 AM |
|
Quote jjrjr1:
Also maybe try this.
opener.location.reload(true);
self.close();
Let me know if this does work for you. I will be curious to know
Have Fun
IT works!! simple and easy.
Thank You Kindly!
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/06/2008, 10:16 AM |
|
My Pleasure.
Glad it worked!!
Take Care
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/06/2008, 11:14 AM |
|
BTW
Here is a complete post for this solution including the Grid code for calling the popup update window.
I hope this helps you and anyone else wanting to do this
http://ccselite.com/forums_topics_view.php?forum_id=8&forum_topic_id=20
Have Fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
maxhugen
Posts: 272
|
| Posted: 11/06/2008, 3:19 PM |
|
As an alternative to having a separate "window close page", I add a URL parameter (eg &saved=1) to the current page. In the window.open I run a function to check this param using CCGetParam(), which if set, then does what John suggested.
Note: the javascript version of CCGetParam() requires that you enter the param in lower case.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |