chiller has asked for the wisdom of the Perl Monks concerning the following question:

Using LWP, if I want to POST a request to a web page, and the web page has an "image" input type as the submit button, it goes in the header like so:
Input_tag_name.x=0&Input_tag_name.y=0
and this will submit correctly.

What if, by some stretch of HTML standards, the image tag _has no name_? How do I submit then? Not so sure if this is perl-specific but I think if anyone ever has to deal with this, they're probably using perl to do it, so...

thanks

Replies are listed 'Best First'.
Re: Image input type + POST request
by chromatic (Archbishop) on Aug 18, 2001 at 02:42 UTC
    My HTML/XHTML book (the Koala) says the name attribute is optional, but does not indicate how to handle this case. From a practical standpoint, without a name, it's unclear how anyone would get at the coordinates in a CGI program.

    I'd suggest just submitting the form normally. Anyone who uses an image as a submit button (such as 'search' in the header up above) doesn't care where the mouse was when the user clicked. Either name your input elements, or ignore them.

    If I remember, I'll dig through an RFC later.

      After some twiddling around I found out:

      To submit a form which uses an 'image' input tag, and the tag has no name, simply use x and y:

      x=0&y=0

      and the form will submit. On really picky servers anyway.