Open Pop-up window and Pass parameter value in Oracle Apex using JavaScript & AJAX
Steps: Create 2 pages
- Page_1: Name = Master page, In this Page simply create a Text Field : P1_ITEM, Button: BUTTON_OPEN_POPUP
- Page_2: Name = Pop-up Page, In this Page simply create a Text Field: P2_PARAM
- Create a Dynamic Action against the BUTTON_OPEN_POPUP in Page_1
- Dynamic Action Property:
- Name: Process to launch Pop-up
- Selection Type: Button
- Button: BUTTON_OPEN_POPUP
- True Action: Execute JavaScript Code
- Code:
1 2 3 4 5 6 7 8 9 |
apex.server.process("DYNAMIC_URL_PROCESSING", {x01:$v("P1_ITEM")}, {dataType: 'text',success: function(data) { var vUrl = data; eval(vUrl); } } ); |
5. Now create an AJAX callback process named DYNAMIC_URL_PROCESSING which will return dynamic link along with parameter value in the dynamic action calling process.
6. AJAX callback process property:
- Name: DYNAMIC_URL_PROCESSING
- Type: PL/SQL Code
- Point: Ajax Callback
- PL/SQL Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
declare v_return_url varchar2(500) := null; v_url_text varchar2(500) := null; v_param_val number; begin v_param_val := APEX_APPLICATION.G_X01; v_url_text := 'f?p='||:APP_ID||':2:'||:APP_SESSION||'::::P2_PARAM:'||v_param_val; v_return_url := apex_util.prepare_url(v_url_text); HTP.PRN(v_return_url); end; |
Note : In the case of multiple parameter value passing the URL do as shown in the below:
1 |
v_url_text := 'f?p='||:APP_ID||':2:'||:APP_SESSION||'::::P2_PARAM,P3_PARAM:'||v_param_val||','||v_param_val2; |
7. Now run Page_1, Put some value in the item P1_ITEM (example 1), click the button BUTTON_OPEN_POPUP, it will take you to the Page_2 and value 1 from item P1_ITEM in Page_1 will be passed to the item P2_PARAM in page_2
Thank You
First of all thank you so much for this tutorial! I’ve been trying to achieve this for hours and finally I’ve been able to.
But now I would like to pass a value from the master page that would fill more than one field in my pop-up page. What do I need to do to so that P1_ITEM would fill not only P2_PARAM but also, let’s say, P3_PARAM?
I’m new to apex and I suppose that some change in “‘::::P2_PARAM:'” that would translate into “P2_PARAM and P3_PARAM” would do the trick. I just don’t know how to implement it.
Once again, thank you very much!
Try this:
v_url_text := ‘f?p=’||:APP_ID||’:2:’||:APP_SESSION||’::::P2_PARAM,P3_PARAM:’||v_param_val||’,’||v_param_val3;
That worked like a charm. Thank you once again!
Nice tutorial!
What if you wanna pass a value with special characters? something like ###-##-####, being # any number.
cheers!
Great post. I used to be checking continuously this weblog and I am inspired!
Extremely helpful info particularly the ultimate sectio 🙂 I take care of such info much.
I was looking for this certain info for a long time.
Thanks aand berst of luck.
Hurrah! In the end I got a weblog from where I be able too genuinely take helpful data regarding my
study and knowledge.
Definitely believe that which you said. Your favorite justification appeared to be
on the web the simplest thing to be aware of.
I say to you, I definitely get annoyed while people
consider worries that they plainly don’t know
about. You managed to hit the nail upon the top as well as defined
out the whole thing without having side-effects , people could take a signal.
Will likely be back to get more. Thanks
Hі there mates, itts fantastic paragraph օn the topic օf tutoringand entіrely defined, keep it up all tһe time.
Pretty ѕection of сontent. I just stumbled upօn yojr sitte and in accession capital tо assert tһat I acquire aactually enjoyed account youyr blog posts.
Αnyway I will be subscribing to your augment aand eνen I achievement үoս access consistently rapidly.
Ꮃһɑt’ѕ up, Steve from Bridges.
Wow “Ⲟpen popup window and pass vaslue սsing JavaScript in oracle apex”
certainly an original subject
Simply ᴡanted to share tһat Ι ⅼike yoսr blog.
Eνerything іs very openn with a cleaqr description ߋf the issues.
It waѕ rеally informative. Үouг website iѕ very usefuⅼ.
Thank уou foor sharing!
This is my first time go to see at here and i am genuinely impressed to
read everthing at single place.
Thanks for another fantastic article. The place else
may anybody get that kind of info in such an ideal method of writing?
I’ve a presentation next week, and I’m on the search for such information.
That is a good tip especially to those fresh
to the blogosphere. Simple but very precise info… Appreciate your sharing this one.
A must read post!
I’m still learning from you, as I’m trying to achieve my goals.
I certainly enjoy reading everything that is written on your
site.Keep the information coming. I liked it!
Here is my website – definition duty cycle
I have been exploring for a little bit for any high-quality articles or weblog posts on this sort of space
. Exploring in Yahoo I eventually stumbled upon this website.
Studying this info So i am satisfied to convey that
I’ve an incredibly good uncanny feeling I found out exactly what I
needed. I such a lot for sure will make certain to do not fail to remember this site and
give it a look regularly.
Thanks very nice blog!
For the reason that the admin of this site is working, no uncertainty very quickly it
will be well-known, due to its quality contents.
Thank you for the good writeup. It if truth be told used to be a enjoyment account it.
Look complicated to more brought agreeable from you! By the way, how could we be in contact?
That is a great tip especially to those fresh to the blogosphere.
Brief but very accurate information… Thank you for sharing this
one. A must read post!
I’m still learning from you, as I’m trying to achieve
my goals. I absolutely enjoy reading everything that is written on your website.Keep the
tips coming. I enjoyed it!
My web page: ht engineering