Strange Safari onClick problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacqui

    Strange Safari onClick problem

    Hi,

    I am trying to write a webpage that has a form on it, which gets
    submitted when a button is pressed, but also has an onclick event
    which does some DOM manipulation to display a waiting page.

    The issue that I am facing is that in Safari, a blank screen is being
    displayed rather than the waiting page. This is only happening if
    there are form tags around the button

    i.e., this works and brings up the waiting page:

    <input type="submit" name="submit" onclick='return interstitial(); '/>

    whereas this does not:

    <form method="get" action="<slow loading page>">
    <input type="submit" name="submit" onclick='return
    interstitial(); '/>
    </form>

    This does not appear to be a problem in Firefox/IE. Has anybody else
    faced this problem and would be willing to help me out with this?

    Many thanks in advance,
    Jacqui
  • VK

    #2
    Re: Strange Safari onClick problem

    On Apr 21, 12:57 pm, Jacqui <jasn...@ntlwor ld.comwrote:
    Hi,
    >
    I am trying to write a webpage that has a form on it, which gets
    submitted when a button is pressed, but also has an onclick event
    which does some DOM manipulation to display a waiting page.
    >
    The issue that I am facing is that in Safari, a blank screen is being
    displayed rather than the waiting page. This is only happening if
    there are form tags around the button
    >
    i.e., this works and brings up the waiting page:
    >
    <input type="submit" name="submit" onclick='return interstitial(); '/>
    >
    whereas this does not:
    >
    <form method="get" action="<slow loading page>">
    <input type="submit" name="submit" onclick='return
    interstitial(); '/>
    </form>
    >
    This does not appear to be a problem in Firefox/IE. Has anybody else
    faced this problem and would be willing to help me out with this?
    <form method="GET"
    action="slow_lo ading_page.cgi"
    target="hidden_ frame"
    onsubmit="retur n interstitial(th is)">
    <!-- other form elements -->
    <input type="submit">
    </form>
    <iframe name="hidden_fr ame" src="blank.html "
    style="display: none !important"></iframe>

    where

    where interstetial does validation, sets waiting message and returns
    true

    Because form submission means leaving the current page, you have to
    dump the server output to a hidden frame, otherwise it has no sense to
    display any DOM waiting message - they will disappear a ms later.

    If you are using an ajaxoid to submit your form then respectively you
    have to cancel form submission and do the job manually, in such case
    iframe is not needed:

    <form method="GET"
    action="slow_lo ading_page.cgi" >
    <!-- other form elements -->
    <input type="button" value="Submit"
    onclick="inters titial(this.for m)">
    </form>

    1) interstitial has to show waiting message first, then over
    setTimeout proceed with form submission: otherwise the screen will
    never be updated.
    2) a fallback should be provided in case Javascript disabled. One of
    options:

    <script>
    document.write( ''.concat(
    '<input type="button" value="Submit"' ,
    ' onclick="inters titial(this.for m)">'));
    </script>
    <noscript>
    <input type="submit">
    </noscript>


    Comment

    Working...