Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Open and Close Popup With Javascript

Gus CMay 10 2012 — edited May 10 2012
Using Apex 3.2

I have probably done this loads of times in my old job, but do not have access to the code and today I just can't get it to work properly.

I have opened a pop up window with javascript
Now I need to close it and refresh the calling page, but only if it passes the validation on the popup.
I have a hidden item on my pop up called P7_FLAG.
I have a page process after validation that sets P7_FLAG to (only set to 1, if passes validation).
I also have a SUBMIT button.

So once I click my SUBMIT button the page should look at the validations, if ok, set P7_FLAG to 1, then close the popup and refresh the calling page.

My current javascript look like this
<script type="text/javascript">
function saveChanges(){
doSubmit('SUBMIT');
var test = $x('P7_FLAG').value;
if(test == '1')
{
window.close();
window.opener.doSubmit('REFRESH');
}
}
</script>
On my button
javascript:saveChanges();
The problem is that I need to click the SUBMIT button twice.
First time it sets P7_FLAG
Second time it closes page and refreshes.

I have probably made some basic error, but today I cannot see it.

Cheers

Gus

Edited by: Gus C on May 10, 2012 12:48 AM
This post has been answered by VC on May 10 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2012
Added on May 10 2012
9 comments
2,737 views