How can I Close a popup window, after execute Update SQL. (Oracle APEX 21.1) - oracle-apex

I created a pop-up page. That pop-up window has a radio button, a text box, and an execute button. I want to work that page working like... when pressing the button, run a update SQL with the values of the radio button and text box, and close itself.
I tried that answer in the following link. But the pop-up page just reloaded and the page stayed open. How to close popup window in Oracle-apex?
If possible, I would like to validate the value of the text box. If it was an incorrect value then break the process with a message. If path that validation, run a update SQL and close the pop-up window.
Thank you for your kindness for read this confusing question.

You should be using a "Close Dialog" process type after your Save Process.
Make sure that you also set the server side condition accordingly so that the dialog only closes after your save process.

I GOT RESOLVED IT!
Not use any close method, redirect util is fine work like this APEX_UTIL.REDIRECT_URL (APEX_PAGE.GET_URL(p_page => 7));
Thank you to all ppl for look this page :)

Related

How do I use Spy++ on this menu that keeps disappearing if I click outside of it?

I want to log the messages of this menu using Spy++.
Usually, if I want to log the messages of a window, I would use Spy++ and drag the "Find Window" tool over it. But in this case, if I drag the tool over this menu, the menu disappears because I clicked outside it.
Is there any workaround to this?
A little more information:
What I want to achieve is finding out what messages are sent when I click the menu's items (they are buttons).
That particular menu in the first picture is created only when I click the button, and it has a different HWND every time I click it.
If I can't accomplish this in Spy++, can I do this using some other application similar to Spy++?
Actually I figured it out myself.
You can just log messages of the parent window with the logging options set to also log messages of child windows.

How to close window in apex builder on clicking a button

I have an apex page where I have a button "SAVE & CLOSE" . On click of that button, I first want to save the data and then close the page.
I have a PLSQL code at point "Processing" to save the data.
I have then created a Branch at Point = "After Processing" and Type ="PLSQL Procedure" and written below code to close the window.
Begin
htp.p('<script type="text/javascript" >');
htp.p('window.close();');
htp.p('</script>');
end;
I have added the button's name in server side condition : When button Pressed.
But this doesn't work. When I click on apply, it doesn't close the window. It gives me an error :
"Error: SyntaxError: Unexpected token < in JSON at position 0 "
Can you please help me resolve this error and tell how can I close the window in button click.
Thanks,
Abha
You can use only APEX components and not write a single line of code :)
Set action for your button to "Submit page" - so all items will be submitted to use their values in processing. Image below will help you.
Now, for processing your pl/sql code use process in processing(left side on the picture).
Here you can create a new process and set type to "Close dialog" this process will automatically close the window. Without any javascript etc.. Apex is processing from top to bottom, so if you make this process last, it will always close the window after all processes are done.
You can as well set process server side condition, so it will not trigger every time.
Be careful with javascript - some web browsers are processing them in different way.
Hope it will help. Have a nice day !
Hi I got it working with other method :
Instead of type : PLSQL Procedure" select Type = "Page or URL Redirect"
and give
javascript:window.close()
in the Target.
This works.
What I did was make the page Modal. Then I added a Button called btnClosePage with a Dynamic Action (True Event) that calls "Close Dialog". I am working in Oracle Apex 20.2.

Cant focus Firemonkey application when modal dialog open, unless modal dialog itself is clicked

I have an application in which users, upon logging in, are prompted with a modal dialog where they must choose the facility they wish to work out of. At this stage, the application looks like this:
The modal dialog is shown by calling this method:
bool __fastcall ShowFacChoiceForm()
{
TFacChoiceForm *Form = new TFacChoiceForm( Application );
bool Result = ( Form->ShowModal() == mrOk );
delete Form;
return Result;
}
In this case, TFacChoiceForm inherits from TForm so the ShowFacChoiceForm() function is calling the standard TForm.ShowModal method documented here.
The issue I am running into is that if my application loses focus, it cannot become the active window again unless the modal dialog itself is clicked. To better illustrate this, I will present the following scenario:
Lets say its Friday afternoon and I decide to goof off a bit and read some web comics. With my application open, I open up another window on top of it, like so:
Then, out of nowhere my boss comes in for a performance review, and I attempt to refocus my application by clicking somewhere on the main form. For example, at the position of this red X in the next image.
In the above image, I have clicked at the location of the red X. Now, both the form containing the web comic, and my application are inactive. Thus, my application does not come to the front of the screen.
However, if I am able to click somewhere on the modal dialog, like the red X in the following image...
...then my application comes to the front like one would expect.
To solve this, I have looked at using something like SetForegroundWindow from the Windows API, but I have not been able to find a way to trigger the event, since my main form does not fire events while I have a modal dialog open.
My question is, how can I make sure that if the user clicks anywhere on my application that it is brought to the front? Is there a property I can edit in my form to do this?
If you set modalresult to mrcancel in the ondeactivate of the modal dialog then the main form will get focus when its clicked. You can then check if the user is logged in the mousedown event of the main form and if not, show the modal dialog again.

Going back to the main page after closing the pop up window

I am having a problem on handling the pop up windows in robot framework.
The process I want to automate is :
When the button is clicked, the popup window appears. When the link from that popup window is clicked, the popup window is closed automatically and go back to the main page.
While the popup window appears, the main page is disabled, and it can be enabled only when the link from the pop up window is clicked.
The problem I have here is that I cannot go back to the main page after clicking the link from the popup window. I got the following error.
20140604 16:04:24.160 : FAIL : NoSuchWindowException: Message: u'Unable to get browser'
I hope you guys can help me solve this problem.
Thank you!
I had the same issue and here is the method to resolve the issue
String window = driver.getWindowHandle();
Now click the button to invoke the popup and give some wait time
and then switch to ur new window with the below code
driver.switchTo().window("your new window name");
//perform your action in the new window and then
To get back control over your main page after the popup closes, use the below code
driver.switchTo().window(window);
This will help you activate the main window and continue your action there.
Let me know if this helpw
No idea in Python but in Java you can use below code after pop opened to solve your problem:
Object[] parentHandle = myDriver.getWindowHandles().toArray();
myDriver.switchTo().window((String) parentHandle[0]);
In the first line of code parentHandle is the number of current
windows in Array form. And in second line of code I am switching to
the first window, for second window you can use 1.
If still have problem or you need something else, please suggest.
I have seen this issue and found that there is a recovery period where Selenium does not work correctly for a short time after closing a window. Try using a fixed delay or poll with Wait Until Keyword Succeeds combined with a keyword from Selenium2Library.

How do I test modal dialogs with Selenium?

I'm getting started with Selenium IDE and trying to test a webapp that's full of modal dialogs (window.showModalDialog).
Recording the test seems to work (except there's nothing in the log when the dialog pops up) but they don't play back properly. The script actually opens the window (triggered by a button click), but then just waits indefinitely.
Any suggestions?
From the Selenium FAQ, Selenium apparently works with some types of dialogs but not others:
I can't interact with a popup dialog.
My test stops in its tracks!
You can, but only if the dialog is an
alert or confirmation dialog. Other
special dialogs can't be dismissed by
javascript, and thus currently cannot
be interacted with. These include the
"Save File", "Remember this Password"
(Firefox), and modal (IE) dialogs.
When they appear, Selenium can only
wring its hands in despair.
To solve this issue, you may use a
workaround (if one exists); otherwise
you may have to exclude the test from
your automated corpus. For the "Save
File" dialog in Firefox, a custom
template may be specified when running
via the RC that will always cause the
file to be downloaded to a specified
location, without querying the user
(see
http://forums.openqa.org/thread.jspa?messageID=31350).
The "Remember this Password" dialog
should not appear again after you've
chosen to remember it. Currently there
is not much that can be done about IE
modal dialogs.
I seem to remember someone working around this with an AutoHotKey script that dismissed the dialog.
I have been using Selenium IDE to test jQuery modals for quite sometime now, I never faced any problem. Here are the things I do to ensure that the test executes properly on playback:
execute the script at the slowest possible speed
when the modal opens, I use the waitForElementPresent command to verify the presence of at least one of the constituent elements on the page; argument being, if one element loads properly, it is safe to assume that all the elements and hence the modal window loaded up properly.
Hope this helps. If you want further help, you can share the code with me alongwith the error in execution that IDE throws out to you.
Modal window hacked:)
http://seleniumdeal.blogspot.com/2009/01/handling-modal-window-with-selenium.html
This is how I handle pop up alert in Selenium IDE
right click on the element (in this case your pop up window) there are some command you can choose. There's also a show all available commands whiche might be a help.
You should use AssertElementPreset and I guess the best locator in this case is CSS. So you can choose AssertElementPresent.
Or
you can use two command on Selenium IDE
selectWindow | null
verifyElementPresent | css=div.content
Hope this helps!