On May 29, 4:15 pm, Tim Slattery wrote:
> We have a legacy app that uses a somewhat odd method of
> submitting a page, and it's giving us fits.
>
> There's no "<input type='submit'...> button on the page.
> What is there is an image of a "Continue" arrow surrounded
> in an <a ... > tag. Here it is:
So an <input type="image"> could have given the save visual
presentation.
> <a href="" onclick="submit_page(contactForm, 'prices');
> return false;"
> title="Continue through the Web site" scope="request" >
> <img border="0" src="/GlobalContent/images/arrowContinue.gif"
> align="middle"/>
> </a>
>
> The "submit_page" script sets a couple of values and submits
> the form
> Works just fine, nearly always.
Having a real submit button of some form and having onsubmit
code add the values would be more reliable (and putting these
values in the form to start with would be more reliable still).
> The problem is that in a very few cases, it looks like the
> href tag is activated (for lack of a better term) without
> triggering the onclick. The result is that the page is
> submitted to a nonexistent address.
An empty HREF should be the top of the current page, which cannot be
a non-existent page if you are already viewing it.
> So my question is how could this happen? I've tested tabbing to the
> continue arrow, then using the enter key, CTRL-enter, and several
> other combinations. All seem to work. Is there any way to activate
> the "a" tag without triggering the onclick?
Right click and select "Open link", "Open in new tab" or "Open in new
window" would bypass the onclick code (as you would not have 'clicked'
in that case).
Any error thrown in the - submit_page - function would prevent
execution from getting to the - return false; - and so the default
action of the A element would not be cancelled.
There is also a possibly that a poorly coded add-on/toolbar or similar
browser extension is interfering with the onclick code.
Also, aggressive javascript code distributed with (some) adverts could
be replacing onclick handlers (or interfering with them), but you
wouldn't put an important form on a page that also imported content
from uncontrolled sources so it won't be that.
> The errors seem to be reported by people using IE8. I've run my tests
> with that browser and haven't turned up anything.
Richard.