Re: HTML::Form not submitting submit button name/value

2009-08-14 Thread libwww

On Wed, 12 Aug 2009, Gisle Aas wrote:


I don't see that here.  click() and make_request() seem independent.
click() is just a wrapper for make_request() that makes the
first/given submit/image active.


Ok, I retested this and it looks perfectly ok now. Might have been due
to an upgrade from an earlier version of HTML::Form, hard to say now,
but if I see anything suspicious, I'll post it. Thanks for your help on
this!

-- Mike

Mike Schilli
lib...@perlmeister.com


Re: HTML::Form not submitting submit button name/value

2009-08-12 Thread Gisle Aas
On Tue, Aug 11, 2009 at 22:24, lib...@perlmeister.com wrote:
 On Tue, 11 Aug 2009, Gisle Aas wrote:

 print $f-click-as_string, \n; print $f-make_request-as_string, \n;

 That's cheating :). Leave out the first click() and check what
 make_request() by itself gets you.

 Looks like the preceding click() has some mysterious side effect on
 the subsequent make_request().

I don't see that here.  click() and make_request() seem independent.
click() is just a wrapper for make_request() that makes the
first/given submit/image active.

--Gisle



 -- Mike

 Mike Schilli
 lib...@perlmeister.com

 On Tue, Aug 11, 2009 at 08:24, lib...@perlmeister.com wrote:

 On Mon, 10 Aug 2009, Gisle Aas wrote:

 HTML::Form supported both these by calling either -make_request or
 -click method. If all modern browsers agree that the button value
 should always be passed we should change as well.

 Interesting, both click() and make_request() yield the same result
 here, excluding the name/value of the submit button in both cases:

 It does not here:

 use HTML::Form;
 my $f = HTML::Form-parse('EOT', http://localhost/;);

  form
     input type=submit value=Upload it! name=n
     input type=text name=t value=1
  /form
 EOT



 This prints:

 GET http://localhost/?n=Upload+it!t=1
 GET http://localhost/?t=1




Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread libwww

On Mon, 10 Aug 2009, Gisle Aas wrote:


Both current Safari and Firefox seem to send x=xy=y when
clicking on the image.


I see, I was using the test form

form
   input type=submit value=Upload it! name=n
   input type=image alt=Foo
   input type=text name=t value=1
/form

from the t/html/form.t test suite. When clicking on the submit 
button, no x or y parameters are set. If you add a src= attribute
to the img tag and a valid image path, and click on the image, the 
browser will set x and y.


(On hitting Enter while editing the text field, I don't get any 
x or y parameters with Firefox 3.)


-- Mike

Mike Schilli
lib...@perlmeister.com


Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread libwww

On Mon, 10 Aug 2009, Gisle Aas wrote:


HTML::Form supported both these by calling either -make_request or
-click method. If all modern browsers agree that the button value
should always be passed we should change as well.


Interesting, both click() and make_request() yield the same result
here, excluding the name/value of the submit button in both cases:

my $f = HTML::Form-parse('EOT', http://localhost/;);
form
   input type=submit value=Upload it! name=n
   input type=text name=t value=1
/form
EOT

print $f-make_request-as_string(), \n;

which prints

GET http://localhost/?t=1

I'd venture that the submit button should be included in both cases,
but I'd have to check the standard to be sure.

-- Mike

Mike Schilli
lib...@perlmeister.com


Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread Gisle Aas
On Tue, Aug 11, 2009 at 08:24, lib...@perlmeister.com wrote:
 On Mon, 10 Aug 2009, Gisle Aas wrote:

 HTML::Form supported both these by calling either -make_request or
 -click method. If all modern browsers agree that the button value
 should always be passed we should change as well.

 Interesting, both click() and make_request() yield the same result
 here, excluding the name/value of the submit button in both cases:

It does not here:

use HTML::Form;
my $f = HTML::Form-parse('EOT', http://localhost/;);

   form
  input type=submit value=Upload it! name=n
  input type=text name=t value=1
   /form
EOT

print $f-click-as_string, \n;
print $f-make_request-as_string, \n;

__END__

This prints:

GET http://localhost/?n=Upload+it!t=1
GET http://localhost/?t=1


Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread Gisle Aas
On Tue, Aug 11, 2009 at 08:14, lib...@perlmeister.com wrote:
 On Mon, 10 Aug 2009, Gisle Aas wrote:

 Both current Safari and Firefox seem to send x=xy=y when
 clicking on the image.

 I see, I was using the test form

    form
       input type=submit value=Upload it! name=n
       input type=image alt=Foo
       input type=text name=t value=1
    /form

 from the t/html/form.t test suite. When clicking on the submit button, no x
 or y parameters are set. If you add a src= attribute
 to the img tag and a valid image path, and click on the image, the browser
 will set x and y.

Do you think HTML::Form should treat a input type=image differently
based on the presence of the src= attribute?  Does modern browsers
just ignore input type=image without a src= (that is treat them as
if they were disabled)?

--Gisle


 (On hitting Enter while editing the text field, I don't get any x or y
 parameters with Firefox 3.)


Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread libwww

On Tue, 11 Aug 2009, Gisle Aas wrote:

print $f-click-as_string, \n; 
print $f-make_request-as_string, \n;


That's cheating :). Leave out the first click() and check what
make_request() by itself gets you.

Looks like the preceding click() has some mysterious side effect on
the subsequent make_request().

-- Mike

Mike Schilli
lib...@perlmeister.com


On Tue, Aug 11, 2009 at 08:24, lib...@perlmeister.com wrote:

On Mon, 10 Aug 2009, Gisle Aas wrote:


HTML::Form supported both these by calling either -make_request or
-click method. If all modern browsers agree that the button value
should always be passed we should change as well.


Interesting, both click() and make_request() yield the same result
here, excluding the name/value of the submit button in both cases:


It does not here:

use HTML::Form;
my $f = HTML::Form-parse('EOT', http://localhost/;);

  form
 input type=submit value=Upload it! name=n
 input type=text name=t value=1
  /form
EOT





This prints:

GET http://localhost/?n=Upload+it!t=1
GET http://localhost/?t=1



Re: HTML::Form not submitting submit button name/value

2009-08-11 Thread libwww

On Tue, 11 Aug 2009, Gisle Aas wrote:


Do you think HTML::Form should treat a input type=image differently
based on the presence of the src= attribute?  Does modern browsers
just ignore input type=image without a src= (that is treat them as
if they were disabled)?


Not sure ... but I'm okay with the way it is right now, I was just
curious why this happened.

-- Mike

Mike Schilli
lib...@perlmeister.com


Re: HTML::Form not submitting submit button name/value

2009-08-10 Thread Gisle Aas
On Mon, Aug 10, 2009 at 22:25, Gisle Aasgi...@aas.no wrote:
 On Thu, Aug 6, 2009 at 00:43, lib...@perlmeister.com wrote:
 P.S.:

 So I turned to the libwww test suite and looked at t/html/form.t:

    $f = HTML::Form-parse('EOT', http://localhost/;);
    form
       input type=submit value=Upload it! name=n disabled
       input type=image alt=Foo
       input type=text name=t value=1
    /form
    EOT

    #$f-dump;
    ok($f-click-as_string, 'EOT');
    GET http://localhost/?x=1y=1t=1

    EOT

 Is x=1y=1 a standard if there's an input image? My browser (FF3) doesn't
 seem to think so.

 The standard (HTML 4.01) does not say what to do when the image has no
 name.  I think this was picked up from inspecting the behaviour of
 some browser but not sure which one.

Both current Safari and Firefox seem to send x=xy=y when clicking
on the image.  If the form is submitted by return in the text field
then both send x=0y=0?  Is that the difference you have an issue
with?

--Gisle