#68 Allow unnamed Image input elments to submit x,y values

Richard Lee

Allow input fields of type image to submit x,y values
even if no name attribute is set.

I didn't look this up to see whether or not it is
allowed by the official HTML spec, but i noted that
when most browsers submit a form from clicking on an
unnamed image element it sends values 'x' and 'y' as
opposed to <name>.x and <name>.y had the element been

I tried to be careful to check that the submit button
was an image before accepting an empty name.


  • Wolfgang Fahl

    Wolfgang Fahl - 2007-12-31

    Logged In: YES
    Originator: NO

    The change is now in the subversion repository and will be in the next release.

  • Wolfgang Fahl

    Wolfgang Fahl - 2007-12-31
    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> closed
  • Wolfgang Fahl

    Wolfgang Fahl - 2007-12-31

    Logged In: YES
    Originator: NO

    Thank you for this patch
    Please find below the test for this behaviour. I added it and made sure it needs to be activated. The default behaviour is still as it was.
    IMHO enabling SubmitButton.setAllowUnnamedImageButton(true); should only be used if you must check websites you don't have under control and that use
    the broken IE behaviour.

    * test clicking on a unnamed Image Button
    * see also FormSubmitTest.testUnnamedImageButtonDefaultSubmit
    * @throws Exception
    public void testSubmitFromUnnamedImageButton() throws Exception {
    boolean oldAllowUnnamedImageButton=SubmitButton.isAllowUnnamedImageButton();
    defineResource( "ask?age=12", "Unnamed Image Button ignored!", "text/plain" );
    defineResource( "ask?age=12&x=5&y=15", "You made it!", "text/plain" );
    defineWebPage( "Default", "<form id='form' method=GET action = \"/ask\">" +
    "<Input type=text name=age value=12>" +
    "<Input type=image id=imageid value=name src=\"\">" +
    "</form>" );
    WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
    SubmitButton button = page.getFormWithID( "form" ).getSubmitButtonWithID( "imageid" );
    assertEquals("empty button name",button.getName(),"");
    assertEquals("x param name",button.positionParameterName("x"),"x");
    assertEquals("y param name",button.positionParameterName("y"),"y");
    button.click( 5, 15 );
    WebResponse response=_wc.getCurrentPage();
    URL url=response.getURL();
    // reset for other test
    // System.err.println(url.getPath());
    assertEquals( "Result of click", "You made it!", response.getText() );


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks