Problem with Opera and JavaScript

Discussion in 'Javascript' started by Shaun Fleming, Jan 21, 2004.

  1. I've been trying to make this simple script compatible across various
    browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
    have version 7.11). This is what is supposed to happen: when the user
    clicks a button in the main window, a dialog window pops up. In the
    dialog the user enters a university to search for. When the string is
    submitted, the dialog then shows all the matches found in the
    database. The user picks one and clicks the Submit button. The Submit
    button's code is as follows:

    <INPUT type="button" value="Submit"
    onclick="javascript:refreshParentWizard(window,
    parent.opener.location);">

    It calls refreshParentWizard(), whose sole purpose is to edit the
    query string arguments so that the main page will save itself when a
    university is returned. Its code is:

    function refreshParentWizard(window, location) {

    // find the querystring (if it exists)
    iQueryString = location.href.indexOf('?');

    if (iQueryString > -1) {
    location.href=location.href.substring(0, iQueryString) +
    "?action=quicksave&screen=previous_education&";
    }
    else {
    location.href=location +
    "action=quicksave&screen=previous_education&";
    }

    document.forms[0].submit();

    self.close();

    return true;

    }

    After the button is clicked, the function is called which submits the
    form and closes the window (as seen in the code above). Then the main
    window is refreshed displaying the University the user picked in a
    field. The problem is Opera will refresh the main page but the
    selected university does not show up. I have tried many different ways
    to do it but none will work. I have checked to make sure that the form
    is passing the right query string arguments when submitted and it is
    passing the same arguments in every browser. I have also checked the
    docs for Opera to see if it supports the functions and it appears that
    it does. I was having problems getting the script to work in NS but I
    got it to work by changing the Submit button type from "submit" to
    "button" and simply calling form.submit(). I am pretty lost so if
    anyone could help me, it would be greatly appreciated.

    Thanks,
    Shaun
    Shaun Fleming, Jan 21, 2004
    #1
    1. Advertising

  2. Shaun Fleming wrote:

    > I've been trying to make this simple script compatible across various
    > browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
    > have version 7.11). This is what is supposed to happen: when the user
    > clicks a button in the main window, a dialog window pops up. In the
    > dialog the user enters a university to search for. When the string is
    > submitted, the dialog then shows all the matches found in the
    > database. The user picks one and clicks the Submit button. The Submit
    > button's code is as follows:
    >
    > <INPUT type="button" value="Submit"
    > onclick="javascript:refreshParentWizard(window,
    > parent.opener.location);">
    >
    > It calls refreshParentWizard(), whose sole purpose is to edit the
    > query string arguments so that the main page will save itself when a
    > university is returned. Its code is:
    >
    > function refreshParentWizard(window, location) {
    >
    > // find the querystring (if it exists)
    > iQueryString = location.href.indexOf('?');
    >
    > if (iQueryString > -1) {
    > location.href=location.href.substring(0, iQueryString) +
    > "?action=quicksave&screen=previous_education&";
    > }
    > else {
    > location.href=location +
    > "action=quicksave&screen=previous_education&";
    > }
    >
    > document.forms[0].submit();
    >
    > self.close();
    >
    > return true;
    >
    > }
    >
    > After the button is clicked, the function is called which submits the
    > form and closes the window (as seen in the code above). Then the main
    > window is refreshed displaying the University the user picked in a
    > field. The problem is Opera will refresh the main page but the
    > selected university does not show up. I have tried many different ways
    > to do it but none will work. I have checked to make sure that the form
    > is passing the right query string arguments when submitted and it is
    > passing the same arguments in every browser. I have also checked the
    > docs for Opera to see if it supports the functions and it appears that
    > it does. I was having problems getting the script to work in NS but I
    > got it to work by changing the Submit button type from "submit" to
    > "button" and simply calling form.submit(). I am pretty lost so if
    > anyone could help me, it would be greatly appreciated.


    Are you getting any errors in the Opera JavaScript console?

    Although you have provided a long description anyone trying to
    understand what could go wrong will much easier be able to do that if
    you provide a URL to a test page where the problem happens. I understand
    that it might be a problem if server side code is involved that is not
    on a public server but maybe a test case with static pages allows to
    demonstrate the problem.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 22, 2004
    #2
    1. Advertising

  3. Shaun Fleming

    Brynn Guest

    Upgrade to IE ... lol ;) ... jk


    On 21 Jan 2004 08:55:30 -0800, (Shaun Fleming)
    wrote:

    >I've been trying to make this simple script compatible across various
    >browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
    >have version 7.11). This is what is supposed to happen: when the user
    >clicks a button in the main window, a dialog window pops up. In the
    >dialog the user enters a university to search for. When the string is
    >submitted, the dialog then shows all the matches found in the
    >database. The user picks one and clicks the Submit button. The Submit
    >button's code is as follows:
    >
    ><INPUT type="button" value="Submit"
    >onclick="javascript:refreshParentWizard(window,
    >parent.opener.location);">
    >
    >It calls refreshParentWizard(), whose sole purpose is to edit the
    >query string arguments so that the main page will save itself when a
    >university is returned. Its code is:
    >
    >function refreshParentWizard(window, location) {
    >
    > // find the querystring (if it exists)
    > iQueryString = location.href.indexOf('?');
    >
    > if (iQueryString > -1) {
    > location.href=location.href.substring(0, iQueryString) +
    >"?action=quicksave&screen=previous_education&";
    > }
    > else {
    > location.href=location +
    >"action=quicksave&screen=previous_education&";
    > }
    >
    > document.forms[0].submit();
    >
    > self.close();
    >
    > return true;
    >
    >}
    >
    >After the button is clicked, the function is called which submits the
    >form and closes the window (as seen in the code above). Then the main
    >window is refreshed displaying the University the user picked in a
    >field. The problem is Opera will refresh the main page but the
    >selected university does not show up. I have tried many different ways
    >to do it but none will work. I have checked to make sure that the form
    >is passing the right query string arguments when submitted and it is
    >passing the same arguments in every browser. I have also checked the
    >docs for Opera to see if it supports the functions and it appears that
    >it does. I was having problems getting the script to work in NS but I
    >got it to work by changing the Submit button type from "submit" to
    >"button" and simply calling form.submit(). I am pretty lost so if
    >anyone could help me, it would be greatly appreciated.
    >
    >Thanks,
    >Shaun


    Brynn
    www.coolpier.com

    I participate in the group to help give examples of code.
    I do not guarantee the effects of any code posted.
    Test all code before use!
    Brynn, Jan 22, 2004
    #3
  4. (Shaun Fleming) wrote in message news:<>...
    >
    > if (iQueryString > -1) {
    > location.href=location.href.substring(0, iQueryString) +
    > "?action=quicksave&screen=previous_education&";
    > }
    > else {
    > location.href=location +
    > "action=quicksave&screen=previous_education&";
    > }


    don't you want "?action=..." here?
    Chris Riesbeck, Jan 22, 2004
    #4
  5. (Chris Riesbeck) wrote in message news:<>...
    > (Shaun Fleming) wrote in message news:<>...
    > >
    > > if (iQueryString > -1) {
    > > location.href=location.href.substring(0, iQueryString) +
    > > "?action=quicksave&screen=previous_education&";
    > > }
    > > else {
    > > location.href=location +
    > > "action=quicksave&screen=previous_education&";
    > > }

    >
    > don't you want "?action=..." here?


    Yea it is "?action=..." in the actual code. I mustve somehow deleted
    the question mark when pasting the code. Sorry.

    Shaun
    Shaun Fleming, Jan 27, 2004
    #5
  6. Martin Honnen <> wrote in message news:<400fba47$>...
    > Shaun Fleming wrote:
    >
    > > I've been trying to make this simple script compatible across various
    > > browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
    > > have version 7.11). This is what is supposed to happen: when the user
    > > clicks a button in the main window, a dialog window pops up. In the
    > > dialog the user enters a university to search for. When the string is
    > > submitted, the dialog then shows all the matches found in the
    > > database. The user picks one and clicks the Submit button. The Submit
    > > button's code is as follows:
    > >
    > > <INPUT type="button" value="Submit"
    > > onclick="javascript:refreshParentWizard(window,
    > > parent.opener.location);">
    > >
    > > It calls refreshParentWizard(), whose sole purpose is to edit the
    > > query string arguments so that the main page will save itself when a
    > > university is returned. Its code is:
    > >
    > > function refreshParentWizard(window, location) {
    > >
    > > // find the querystring (if it exists)
    > > iQueryString = location.href.indexOf('?');
    > >
    > > if (iQueryString > -1) {
    > > location.href=location.href.substring(0, iQueryString) +
    > > "?action=quicksave&screen=previous_education&";
    > > }
    > > else {
    > > location.href=location +
    > > "action=quicksave&screen=previous_education&";
    > > }
    > >
    > > document.forms[0].submit();
    > >
    > > self.close();
    > >
    > > return true;
    > >
    > > }
    > >
    > > After the button is clicked, the function is called which submits the
    > > form and closes the window (as seen in the code above). Then the main
    > > window is refreshed displaying the University the user picked in a
    > > field. The problem is Opera will refresh the main page but the
    > > selected university does not show up. I have tried many different ways
    > > to do it but none will work. I have checked to make sure that the form
    > > is passing the right query string arguments when submitted and it is
    > > passing the same arguments in every browser. I have also checked the
    > > docs for Opera to see if it supports the functions and it appears that
    > > it does. I was having problems getting the script to work in NS but I
    > > got it to work by changing the Submit button type from "submit" to
    > > "button" and simply calling form.submit(). I am pretty lost so if
    > > anyone could help me, it would be greatly appreciated.

    >
    > Are you getting any errors in the Opera JavaScript console?
    >
    > Although you have provided a long description anyone trying to
    > understand what could go wrong will much easier be able to do that if
    > you provide a URL to a test page where the problem happens. I understand
    > that it might be a problem if server side code is involved that is not
    > on a public server but maybe a test case with static pages allows to
    > demonstrate the problem.


    Sorry for the delay in response. I had to ask my boss if it was ok to
    post the site. And No I am not getting any errors in the Javascript
    console. I am currently looking at another thread where another guy
    had a similar problem as me with Opera 7 (I think the thread is called
    "Javascript and Opera 7" or something along those lines). The link to
    the site is <a href="https://was-1.umd.edu/admissions/Entry.jsp">https://was-1.umd.edu/admissions/Entry.jsp</a>
    but u will need to fill out some registration stuff bc this web app is
    currently being used for graduate applications. Once you've filled out
    everything and returned the confirmation email, the problem is when
    you click the Previous Education tab and click the magnifying glass
    next to the "College/University" text field. Another window will then
    pop up where you will have to enter a search string for a college
    name. Once you submit the search a list of matches will come up.
    Select one and click submit. The dialog window will close and the main
    page will be refreshed but instead of having the text field next to
    the magnifying glass, you should see a bullet and the college you
    picked. However, this doesnt work in Opera (the form does not seem to
    be submitted for some reason). If you want to see how it should work,
    do the steps above in IE or Netscape 7. And again, any suggestions
    would be greatly appreciated.

    Thanks,
    Shaun

    P.S. You might not want to actually submit the entire application
    because this site is a prod site and all applications do get looked at
    by the University.
    Shaun Fleming, Jan 27, 2004
    #6
  7. Hi,
    I solved my problem yesterday. After looking at many threads in this
    newsgroup, I was getting the impression that many other people were
    having a problem submitting a form in Opera via the form.sumbit()
    function. I experimented with the code and realized that Opera does
    not submit the form when the form.submit() function is called.
    However, there is no error in the JavaScript console. I tried changing
    the input type of the Submit button from "button" to "submit" (I was
    using an ordinary button that, when clicked, called a function to
    submit the form, refresh the main page, and close the current child
    window in which the form was located. I did this because I was having
    some problems using an input of type "submit" in Netscape.) Upon
    changing the type of the button to "submit", the form was properly
    submitted but I could not close the child window which it was in
    because it would either close the window before the form was submitted
    or it would submit the form and load a white screen before the close()
    function could be called. The solution to this (at least the only one
    I could think of that would work in my particular situation) is to put
    "onunload="javascript:window.close()" in the body tag. Even though it
    seems redundant, in that one would figure that this would be called
    when the window was being closed and as a result be in the process of
    unloading, it works because this is called after the form has been
    submitted but before the next page (the white screen resulting from
    the submission) was loaded. After testing it with under various
    circumstances (i.e. Opera's spoofing ability and other variations),
    the modification seems to work in all cases. Thanks to all who took
    the time to read and try to help me out.

    Shaun Fleming
    Shaun Fleming, Feb 3, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob
    Replies:
    24
    Views:
    1,540
  2. Jerry Asher
    Replies:
    0
    Views:
    121
    Jerry Asher
    Jul 15, 2003
  3. Reinhold Schrecker
    Replies:
    2
    Views:
    147
    Reinhold Schrecker
    Jun 7, 2006
  4. crater

    Opera javascript problem

    crater, Feb 15, 2007, in forum: Javascript
    Replies:
    0
    Views:
    62
    crater
    Feb 15, 2007
  5. crater

    Opera javascript problem

    crater, Feb 15, 2007, in forum: Javascript
    Replies:
    9
    Views:
    121
    Richard Cornford
    Mar 8, 2007
Loading...

Share This Page