Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML form is not working with table inside [duplicate]

Here I placed the table inside form to arrange the form items.
It does not work even though it is valid.

<form method="get" action="another.php">
<table width="50%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="60%">
        Number: <input type="text" name="number" />
    </td>
    <td width="20%" align="center">
        Title: <input type="text" name="title" />
    </td>
    <td width="20%">
        Short Desc: <input type="text" name="shortdesc" />
    </td>
</tr>
</table>
</form>

When I press Enter, the form won't submit.
where as if I place a submit button anywhere inside the form, it works for both Enter key and Button click.

<input type = "submit" value="Submit" />

But I don't want any buttons for submissions. I Submit the form by pressing Enter key.
Any clues why this doesn't work ?

like image 574
Madhusudhan Dollu Avatar asked Oct 04 '22 13:10

Madhusudhan Dollu


1 Answers

Add this to your form

<input type="submit" style="position: absolute; left: -9999px"/>

or

<input type="submit" style="visibility: hidden;"/>
like image 83
Eli Avatar answered Oct 10 '22 14:10

Eli