Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Unable to check checkbox via LWP::UserAgent

by tel2 (Pilgrim)
on Aug 16, 2012 at 09:59 UTC ( [id://987725]=note: print w/replies, xml ) Need Help??


in reply to Re: Unable to check checkbox via LWP::UserAgent
in thread Unable to check checkbox via LWP::UserAgent

Thanks tobyink, but did you see the comment in my original post which said:
"I've also tried:
    'test2\%40mydomain.com_notmetoo' => 'on',
and
    'test2@mydomain.com_notmetoo' => 'on',
without success."

?

Your suggestion looks like the last one of mine above, but with 'off' instead of 'on'.  Are you suggesting that setting it to 'off' will check the checkbox?  I thought it would uncheck it.  Anyway, I've now tried your suggestion, and like my previous attempts, it also does nothing.

I'm guessing that this problem may be caused by the '%' in the element name, but changing the '%40' (hex for '@') to '@' doesn't seem to help.

Replies are listed 'Best First'.
Re^3: Unable to check checkbox via LWP::UserAgent
by tobyink (Canon) on Aug 16, 2012 at 10:28 UTC

    "Your suggestion looks like the last one of mine above, but with 'off' instead of 'on'. Are you suggesting that setting it to 'off' will check the checkbox?"

    Precisely.

    Given the following form:

    <form action="foo.cgi" method="post"> <input name="foo" value="off" type="checkbox"> </form>

    Then when the checkbox is ticked, the string foo=off will be posted to the server. When the checkbox is blank, then the empty string is posted to the server. The string "off" doesn't have any significance to the HTML form. If doesn't mean false, or unticked, or anything. It's just a three-character string that will be posted to the server as the value for the "foo" input when that input has been ticked.

    "I'm guessing that this problem may be caused by the '%' in the element name"

    That may well be the cause. Normally when a form input name contained an "@" I'd expect the HTML itself to contain a plain "@" (or perhaps HTML-escaped as &#x40; or &#64;). The escaping as '%40' would happen when the form was submitted and encoded as application/x-www-form-urlencoded. There might be some double-encoding happening at some stage.

    I suggest taking a look with Wireshark or similar to compare what data LWP::UserAgent is posting compared to what a desktop browser posts.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      Thanks for all that, tobyink.  I appreciate your time, suggestions, etc.

      I haven't had time to touch it again yet.  I might also try creating a small form myself, with '%40' in an element name, and do some experimenting with that to try to isolate the problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://987725]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found