oracle Apex, Issue with Ajax call - oracle-apex-5.1

In Oracle Apex 5.1, I am having issues with Ajax call in my code. There is no error shown as well. Request help in debugging the below scenario.
I created a report with check boxes. This page also has 4 buttons A, B, C, D. I created a page process which is a pl/sql block. Upon clicking on bUtton A OR B this process is being called and executed properly as expected.
For buttons C and D, I wanted to take a user input and pass it to page process.After that only, the process should get executed. For this, I have written an on click dynamic action which prompts for user input upon clicking on buttons C or D.
var order= prompt("Please enter order number", "");
$s('P1_UPDATED_ORDER_NUMBER',order);
alert ($v(P1_UPDATED_ORDER_NUMBER)); // Until this the code is working
apex.server.process ('my_process',{}, {"dataType": "text"});
In the above code, the last line is not showing any result or error. I am not sure if the call is actually made or not?

This issue is resolved by removing apex.server.process() and triggering page submit after above java script is executed.

I believe the actual solution to request the AJAX Callback is to use this:
apex.server.process ('my_process',null, {"dataType": "script"});

Related

Blocking code in custom message box in VB6

In my vb6 project, I created my own msgbox using a form, due to difficulties in changing
the font/language of in-built msgbox. A search with google gave the idea of own msg-
box rather than trying msgbox of VB. Now the problem is : - when the user exits the
program, 3 options are given: to close, to restart and to cancel exit. The user need not
again go through the process of giving password etc in restart option. If I give cancel =
true in the QueryUnload event, then 2nd option does not work, 3rd option works. If
cancel = true is not given, 2nd option works, but 3rd option does not. It appears that
the main form does not get unloaded if cancel = true. Unless & until the main form
unloads, the program will not work with the fresh data to be given by the user in the
initial Form. Since the code after "msgbox.show" depends on options, it is not possible
to write that code in the same sub, not even in the same form code. Is there any way
to stop the subsequent code after "msgbox.show" and continue the same after getting
option? (like in the in-built msgbox of VB.) I am not an expert in VB, so please correct
if I made some mistake; also help with advice/suggestions.
EDIT:- [Extended explanation]
The 3 forms in my project:
Initial form for password, data etc. This is input Form for user.
Main Form. This Form shows the results after process of input.
frmMsgBox. This is a custom msgbox created using a form.
Main Form code portion. Code for closing the program:
Private Sub Form_QueryUnload(Cancel as.......)
cancel = True
frmMsgBox.Label1.caption = Do you wish to 1.Exit 2.Restart
3.Cancel the exit?
frmMsgBox.Show
End sub
(The above msgbox is almost like an in-built msgbox in VB with
vbYesNoCancel buttons) The message is in regional language,
which was the main reason forced me to use my own msgbox.
After MsgBox appears, the user selects one of the above options
using 3 commandButtons placed in that Form. The code after
clicking these buttons is written in the code portion of frmMsgBox:
Command1_Click 'This is for Exit from the Program.
All Forms.unload, All forms set to nothing, end.
Command2_click 'This is for restarting the Program.
Unload Main Form, set to nothing
Load Initial Form
Initial Fom.show
frmMsgBox.Hide
Command3_Click 'This is for cancelling the exit request.
Main Form.Show
frmMsgBox.Hide
With the above code, I have no problem with options 1 & 3,
i.e; to exit from the program or to start. The frmMsgBox hides,
the initial form shows - these are OK, but the main form does
not unload nor it is removed from memory. Because of this,
whatever new data is given by the user in the initial form now
is not being processed, the main form is struck with the old results.
If cancel = true is removed from the code above, Options 1 & 2
are OK, but option 3 does not work. Then the Main Form loses
all its results (all labels, texts etc in that Form turn blank.)

Slack Modal views: expand the stack to more than 3 before final submission

I'm working on a slack bot that have more than 3 modals until I submit it to process.. According to slack docs, the view stack is limit to 3 so I though that I cloud just close the oldest one and free a slot for a new one.. not sure if that make sense (Im actually trying to limit the whole experience to those 3 modals)... in this case goes like this:
Slash command --> views.open (open modal step1 to user and send a null response).
The user submit step1 modal and I trigger a push response operation with the next modal (step2).
idem ... showing modal step3 with a review of the values (I store them using Object Store -Mulesoft)..
this submit with do some process on the data from the step1 and step2 modals and response with a IM to the user with the result
On the 2nd step I tried to trigger a POST to views.push but the trigger ID from the submission is not valid, have to be the trigger id from a block action according to slack.
On step 1 and 2 modals I replace the word SUBMIT with NEXT and only on the final one it say SUBMIT.
One thing... I know that by not closing the views I can close and sort of "go back".. which I will loose if I expand the stack..
I tried to trigger another POST on views.open with a null response for while the response from that POST is good (ok: true)... on the UI... I get the error "We had some trouble connecting. Try again?" on the "step1" modal..
Anyone have any ideas on how can I close modal from the bottom of the view stack so I can add a new one and so on? I know the use case may not be the best (slack apps should make thins easier not form after form..) but just want to know if it can be done).
Thanks!
Well... I have come a long way since I posted this... I ended up using JS but one thing that I want to share if you are on the same situation is that as long you responde the SUBMIT with an sync acknowledgment (is easier in js) the modal will close and then you can send/open another one and so on...

Display Warning popup while entering a new page after the new page is rendered in oracle adf

I have a requirement to show a warning popup while navigating from a page to another page . The warning popup should be displayed when the second page is rendered based on the value of a binding(whether the binding has any value (rendered=true)
or is null(rendered=false)).How can i implement it such a way that the popup would be displayed when the second page is rendered itself?
Assuming few things:
1) By page you mean fragment.
2) You are on JDev 12c +.
This is something you may refer to:
execute code on fragment load
This tells you how to register a ControllerClass for your fragment page definition, and get hold of your phase Id.
You may also directly work with regionContext.getRefreshFlag().
However, please note that this code will fire for every request you make from that fragment. So once you close the warning popup, you should set a page-flow parameter which would prevent the popup from opening further.
For 11g releases, this functionality can be achieved by using the invokeAction binding to call a managed bean method, and setting the refresh condition as prepareRender.
Just add a showPopupBehaviour in the Form and make the TrigerType="load"
follow the follow this link : http://prabhat-java.blogspot.ae/2015/10/displaying-popup-on-page-load.html

How a verify a page in transition using selenium

I clicked on a button on some page which redirects me to some other page.but between these pages there is one page which comes only for 1 or 2 seconds. I have to verify that page.I am using selenium.
Any suggestions?
What you could do here, is do a simple waitForElement subroutine.
Ideally, when your test framework cannot find an element to operate with, it will fail.
So we can assume, that when your test gets past waitForElement(theInterimElement) then your interim element has appeared, and we can continue.
Check the url of the page is the url of the desired page and wait while this is not true.
while (!webDriver.Url.Contains(desiredUrl.ToString()))
Thread.Sleep(50);

How to detect when a website which uses AJAX is completely loaded?

For a website, which doesn't use AJAX I'm using OnDocumentComplete event to know when the page loading is complete.
My question is, how can I detect when website, which uses AJAX requests is ready (e.g. when a website which is fetching some search results by using AJAX finished its work) ?
Ok here is a trick i developed my self.
1-in your html page make a div and set its text to "false".
2-in you server side put a javascript at the end of your returning code. for example your site returns following text upon an ajax call.
a
b
c
d
e
so after this text put a javascript code that will change the text of div from "false" to "true"
so what will happen is that once you receive all the data from ajax call you will also receive the javascript code and that code will run and set the value of div.
so in your page once all data is received you will see the indicator div. and you will know that you have received all data. you can also run functions in similar way upon completion of data.

Resources