473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Submit Javascript Pop-up from main page

Hi I'm developing in Oracle Application Express and I want to put a link on one of my pages that opens a pop-up of a different php page using javascript.

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="text/javascript">
  2. <!--
  3.  
  4. function popitup(url) {
  5.      newwindow=window.open(url,'name','height=500,width=500,  
  6.                        scrollbar=yes,resizable=yes,directories=yes, 
  7.                        toolbar=yes,statusbar=yes,menubar=yes');
  8.      if (window.focus) {newwindow.focus(); }
  9.      return false;
  10. }
  11. //-->
  12. </script>
  13.  
  14.  
  15.  
  16. <a href="http://blah.php" onclick="return popitup('http://blah.php')"
  17.     >Link to popup</a>
  18.  
  19.  

That's just the simple pop-up portion, but what i want to do is submit a form on that new php pop-up page right after the user clicks on the link.

Is this possible?

Thanks Jeff
Dec 5 '08 #1
12 4994
clain
79
sure you can do it... let a page submit be called on page load. or set a timer of say 2 seconds to submit the form
Dec 6 '08 #2
Hey thanks for the quick reply!

While that is what I need to do, I need to call the submit from the main oracle apex page, not from the popped-up php page. I don't know if it is possible to submit a pop-up page from another page?
Dec 7 '08 #3
acoder
16,027 Expert Mod 8TB
You can submit the form from the parent page from the popup by referring to the parent window from the child window, e.g.
Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById("formid").submit();
Dec 7 '08 #4
Thank you Acoder for your reply, but that is still not quite what I want to do, let me see if I can expalin the scenario a little better.

I have a main page. This main page contains a link which calls a javascript function to create a new pop-up window.

On this pop-up window, there is a text field for a part item, and a submit button. I want to be able to put a value from my main page into the pop-up text field and then submit the pop-up. This pop-up window though is not on the same website, it's to a different site.

Ideally it would be something like this..

Expand|Select|Wrap|Line Numbers
  1.  
  2. function popitup(url) {
  3.       newwindow=window.open(url,'name','height=500,width=500,  
  4.                          scrollbar=yes,resizable=yes, directories=yes, 
  5.                          toolbar=yes,statusbar=yes,menubar=yes');
  6.       if (window.focus) {
  7.           newwindow.focus();
  8.       }
  9.  
  10.      newwindow.document.getElementById('searchNumber').value='300';
  11.      newwindow.document.getElemetnById('searchNumberForm'.submit('go'); 
  12.  
  13.  
  14.     return false;
  15. }
  16.  
  17.  
1) Still the main question is this even possible or something like this?

2) My link looks like this...

Expand|Select|Wrap|Line Numbers
  1.     <a href="blahsite.php" onclick="return popitup('blahsite.php')">
  2.     Link to popup</a>
  3.  
Dec 8 '08 #5
acoder
16,027 Expert Mod 8TB
If the form page in the popup is on a different site, then it won't be possible unless you serve the page from your domain.

If it's from the same domain, what you can do is in the onload of the popup, get the value from the parent using parent.opener, set the value of the text field and then submit from the popup. The reason you have to do it in the pop-up onload is that the window is not available immediately. You could use a timeout, but that assumes that it will be opened and loaded in that time.
Dec 8 '08 #6
Ok I was afraid of that. The pop-up page is of a different server, I'm not sure about the domain though. If it was on the same domain could it be done then?
Dec 8 '08 #7
acoder
16,027 Expert Mod 8TB
Yes, it can be done. If you're using server-side code, you could serve the cross-site page from your domain.
Dec 8 '08 #8
clain
79
i have an alternate idea... why not we use Query String for the same?? rather than posting the pop up page use a query string..

pass the Query string to pop up as query string and also on submitting you can use a query string back to return the value.

it will be good to have a server side technology such as PHP,JSP,ASP. to get the things easier(i mean to get the query string variables easily ) ...

You can also do the same with java script.!!!!

Jeff, if you need more clarification on how to do it? please do post back .. so that we can help more..

enjoy
Dec 9 '08 #9
To Acoder:

I'm sorry if I do not quite understand, but what is "serving the cross site page from your domain?" How would you implement this, is there any way you could give me an example or some resource to read up on?




To Clain:

The only problem with the querystring idea is that I do not have access to the page that is being popped up. It is on a different server, it is using PHP, but I do not know how to pass it the correct value as a querystring.

Let me explain a little further....

This PHP site has a big list of part numbers, and at the top it has a "Search By Number" form. I basically just want to insert a part number into the text box in that "Search By Number" form and submit that form, which will return a pdf of that part.


Thanks for all of your help so far.
Dec 10 '08 #10
acoder
16,027 Expert Mod 8TB
@jeschafe
For example, you could use Curl. There's also a library in PHP for Curl.

The only problem with the querystring idea is that I do not have access to the page that is being popped up. It is on a different server, it is using PHP, but I do not know how to pass it the correct value as a querystring.
You don't need access to the page if you pass in the value when opening the popup, e.g.
Expand|Select|Wrap|Line Numbers
  1. window.open("popup.php?val=" + encodeURIComponent(document.getElementById("id").value),"win");
Dec 11 '08 #11
@acoder

Right, I understand that portion, my problem is I don't know what they call "val" as part of their php page.


This "pmd.php?bb=0&pmdQsa=a16041475ede60a4d44b1c819049a be6" is the query string portion of the url that comes up when searching for part number 6735350. It should be something simple like "pmd.php?partNum=6735350". But instead it's all that garbage which makes me think they are encoding it or something.

Is it still possible to do at all?

Thanks,
Jeff
Dec 16 '08 #12
acoder
16,027 Expert Mod 8TB
Yes, it does seem like that. How is it converted to the other value? Do you have permission from the website owner to use their site in this way? If so, you can use whatever is used to convert to submit to the page, or use PHP Curl to get the contents of the page from the site.
Dec 17 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: RavenMaster | last post by:
I have a javascript form field validation script that I have used many times with no problems. However, I just started using the script in a PHP application that uses trans-sid for session...
5
by: LevaOpaki | last post by:
Why this work? <a href="#" onClick="Forma1.reset()">Link1</a> and this not? <a href="#" onClick="Forma1.submit()">Link1</a> I get error.
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
2
by: DB | last post by:
Hi All Having stared at this all morning and altered various things with no effect other then to exasperate the problem i'm wondering if anyone could take a look at the code below and see why on...
1
by: jrefactors | last post by:
When the user type something in text box, and press enter, it will submit the form data to test2.jsp, even without pressing submit form button. This is not what I want, I want to submit the form...
5
by: terence.parker | last post by:
I have a PHP application which I wrote last year - and the JavaScript worked fine then. For some reason, now it doesn't - neither on IE nor Firefox. Has something changed? When I click on my...
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
5
by: IchBin | last post by:
Not sure if I should post this to a javascript group or here. So I'll try here first since most here mix both in this group. I am trying to pass a php value into a JavaScript function that changes...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.