HELP!!! onclick this.form is empty...

P

ppy

Hello!

i've got a form:

Witam!

mam formę:

<form name="form1" method="post" action="/">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td>Login:</td>
<td><input name="login" type="text" size="12"></td>
</tr>
<tr>
<td>Hasło:</td>
<td><input name="haslo" type="password" size="12"></td>
</tr>
<tr align="right">
<td colspan="2"><a href="#" class="aakcja"
onclick="this.form.submit();">login</a></td>
</tr>
</table>
</form>

1. when I click on "login" a get an error "this.form is empty or
......" WHY?
2. when I enter a login and press ENTER there is no action? Form isn't
submitted! WHY? WHAT'S WRONG
 
M

Martin Honnen

ppy wrote:

<form name="form1" method="post" action="/">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td>Login:</td>
<td><input name="login" type="text" size="12"></td>
</tr>
<tr>
<td>Hasło:</td>
<td><input name="haslo" type="password" size="12"></td>
</tr>
<tr align="right">
<td colspan="2"><a href="#" class="aakcja"
onclick="this.form.submit();">login</a></td>

What is wrong with
<input type="submit" value="login" class="aakcja">
instead of the link? That way your visitors can submit the form in any
case, whether JavaScript is supported or not.

As for the link, it doesn't have a form property so you would need
<a href="#"
onclick="document.forms.form1.submit(); return false;">login</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top