Question about mechanize and input type image

Hello i'm having a issue trying to submit a form using mechanize. The
thing
is that the form don't have a submit button but a input type="image".

Someone knows how to do this with mechanize or if its not possible
with mechanize there is another library to do this?

This is the form im trying to send

<form action="index.php" method="post">
<tr>
      <td class="inptext"><b>User name</b></td>

  <td><input name="uname" size="10"></td>
</tr>

<tr>
  <td class="inptext"><b>Password</b></td>
  <td><input name="upass" size="10" type="password"></td>
</tr>

<tr>
  <td align="center" colspan="2">

  <table cellspacing="0" cellpadding="0" border="0">
  <tr>
  <td align="right"><input name="urem" type="checkbox"
value="remember"></td>
  <td class="inptext">Remember me</td>
  </tr>
  </table>
  </td>
</tr>

<tr>
  <td colspan="2" align="center">
  <input type="image" border="0" src="images/submit.gif">
  </td>
</tr>
<tr>
       <td colspan="2" align="center"><a class="TopNav"
href="http://www.sendsmsnow.com/forgetpass.php">Forgot
password?</a></td>
</tr>

</form>

I think the problem may be that you are trying to nest a form within a
table. The only way you can put a form inside a table is if the form
lies entirely within one cell of the table. A table may reside
entirely within a form of course.

Colin

I'm not sure if that's the problem because i can work with the form
assing values to the fields of uname and upass. I've tried to find a
solution for this issue in google but couldn't find a solution that
works.

May be a little more information will help i'm using mechanize 2.0.1 and
this is some of the code that i use for sending the form.

page = agent.get(url_mail)

log = page.forms.first
log.uname = "user"
log.upass = "password"

logeado = agent.submit(log)#i used this after other unsuccessful atempts
to
#submit the form. I'm not sure if the agent.submit is clicking the right
#button but it returns a response but...
sl = logeado.field("country") #i got the error undefined method 'field'
for Mechanize::page:0xxxxxxxx

The first thing to do is to get to valid html. You cannot make any
conclusions about anything with invalid html. To check that it is
valid view the page source (View > Page Source or similar in your
browser) copy the complete text and paste it into the w3c html
validator. When you have invalid html the browser (which will know
that it is invalid) has to guess what you meant and it may not guess
the way you intended.

There is no point doing anything else until you have valid html. A
golden rule of problem solving, if you know that something is not
right then fix it before worrying about other things that may or may
not be part of the problem.

Colin

Colin Law wrote in post #1015781:

The first thing to do is to get to valid html. You cannot make any
conclusions about anything with invalid html. To check that it is
valid view the page source (View > Page Source or similar in your
browser) copy the complete text and paste it into the w3c html
validator. When you have invalid html the browser (which will know
that it is invalid) has to guess what you meant and it may not guess
the way you intended.

There is no point doing anything else until you have valid html. A
golden rule of problem solving, if you know that something is not
right then fix it before worrying about other things that may or may
not be part of the problem.

Colin

Thanks for this information, i didn't know that w3s have a validator for
html, now i can use it to check things faster that using firebug or
other things.

It seems like the site have a lot of things wrong, like i spected for
what i saw the first time in the source code, but the thing here is that
i don't own that site so i can't do something about that issues.

The
thing
is that the form don't have a submit button but a input type="image".

Have you tried writing your code as if it has a submit button?

Colin Law wrote in post #1015781:

The first thing to do is to get to valid html. You cannot make any
conclusions about anything with invalid html. To check that it is
valid view the page source (View > Page Source or similar in your
browser) copy the complete text and paste it into the w3c html
validator. When you have invalid html the browser (which will know
that it is invalid) has to guess what you meant and it may not guess
the way you intended.

There is no point doing anything else until you have valid html. A
golden rule of problem solving, if you know that something is not
right then fix it before worrying about other things that may or may
not be part of the problem.

Colin

Thanks for this information, i didn't know that w3s have a validator for
html, now i can use it to check things faster that using firebug or
other things.

It seems like the site have a lot of things wrong, like i spected for
what i saw the first time in the source code, but the thing here is that
i don't own that site so i can't do something about that issues.

I don't understand, you are trying to get a form working on a site
that you do not have control over?

Colin

That's correct, so i can't change the form or the input image for a
button.

OK, sorry, I had forgotten what your original question was. I was
thinking that you were describing a problem specific to the form that
you provided the detailed html for. Your best bet might be the
mechanize mailing list (see http://mechanize.rubyforge.org/). Of
course it may be that what you want to do is not possible as mechanize
might not be capable of interpreting the invalid html.

Colin