SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

    Take a look at this standard HTML:

    <FORM METHOD=POST ACTION="http://www.xe.com/ucc/convert.cgi" target=_"top">
    ...
    <SELECT NAME="To">
    <OPTION VALUE="USD">US Dollars</OPTION>
    <OPTION VALUE="GBP">GB Pounds</OPTION>
    ...
    </SELECT>
    ...
    <INPUT VALUE="Click Here to Perform Currency Conversion" type=submit>


    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.

    Thanks in anticipation.
    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:

    function atEnd() {
    var myDropdown = myForm.dropDownValue;
    document.location = "samePage.php?dropDownVal=" + myDropDown;

    openNewBrowserFunction("samePage.php?dropDownVal=" + myDropDown, 'popup', '');

    }


    Just a thought.

  3. #3
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:

    http://www.perthshelldistributors.com.au/shells.htm

    Click on a shell price, and then adjust to a local currency if desired. The site's got a lot of work to do on it yet, but at least this part is working nicely.
    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise

  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested it out for you, and it seemed to work pretty well. Even when I closed the window and revisited, it remembered the currency I wanted, which is good.

    Just of interest, do people really pay that much money for shells!!?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  5. #5
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your comments.

    Apparently there are some 'hard core' shell collectors about who do indeed pay top dollar for really rare 'gem quality' shells. Supply and demand, I guess.

    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •