The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

onclick or onsubmit - need to refresh current page and open another

Hi,

I'm trying to customise a form based on the code they give you from the Universal Currency Converter service (http://www.xe.com/ucc/).

When the submit button is clicked in a form, I need for the UCC page to pop-up in a new browser windown (this is already happening), but also I want my page (in which the form is embedded) to be reloaded and supplied with the currency code selected.

It works fine - it loads up a new browser window with the results of my currency conversion. Great, no problem. But how do I make use of javascript so that when the submit button is pressed, the 'source' page is also refreshed AND supplied (in the URL, eg. source.html?code=GBP) with the "To" currency I've just selected? If I can get it to do this, then I plan to store this currency code in a PHP session variable (or maybe a cookie) so that the chosen "To" currency is remembered (SELECTED) for next time.

It seems as though you want to do 2 things. Open a popup window with information from your form and update your main window with information from your form. one idea might be to eliminate the 'action' from your form and instead, bundle your actions into a function which gets fired during an onSubmit.

I don't know if this would work, but what if your function looked something like this...in pseudoCode:

Thanks for your reply. In the end, I decided to go with a different currency conversion offering from the same service: their embedded/iframe Shopper's Currency Converter at http://www.xe.com/ecc/shoppers/

I then used a little alternative javascript, plus PHP sessions (oh, and currency table from a MySQL database just for good measure), and came up with the following customised solution: