Issue with validator - html

My code, HTML 4.01 Transitional:
<table cellspacing="0" cellpadding="0" border="0" class="forms" id="form-control-number">
<tr>
<td colspan="6" align="right">
<span class="nadpis">Pole pro 14 pozic (*)</span>
</td>
</tr>
<form action="">
<tr>
<td><label class="required" for="numero">GTIN-8</label></td>
<td><INPUT id="numero" class="middle" TYPE="text" NAME=numero SIZE=17 MAXLENGTH=7></td>
<td><INPUT class="text-small" TYPE="text" NAME=cc SIZE=1 READONLY></td>
<td><INPUT class="submit" TYPE="submit" VALUE="Vypočti" ONCLICK="ccc8(this.form); return false;"></td>
<td class="reset-col"><INPUT class="submit" TYPE="reset" VALUE="Vymaž"></td>
<td><INPUT class="text" TYPE="text" NAME=chiffre SIZE=14 MAXLENGTH=14 READONLY><span class="hidden-desktop hidden-tablet">Pole pro 14 pozic (*)</span></td>
</tr>
</form>
<form action="">
<tr>
<td><label class="required" for="numero2">GTIN-12</label></td>
<td><INPUT id="numero2" class="middle" TYPE="text" NAME=numero SIZE=17 MAXLENGTH=11></td>
<td><INPUT class="text-small" TYPE="text" NAME=cc SIZE=1 READONLY></td>
<td><INPUT class="submit" TYPE="submit" VALUE="Vypočti" ONCLICK="ccc12(this.form); return false;"></td>
<td class="reset-col"><INPUT class="submit" TYPE="reset" VALUE="Vymaž"></td>
<td><INPUT class="text" TYPE="text" NAME=chiffre SIZE=14 MAXLENGTH=14 READONLY><span class="hidden-desktop hidden-tablet">Pole pro 14 pozic (*)</span></td>
</tr>
</form>
</table>
The validator is writing: document type does not allow element "FORM" here (line 7)
document type does not allow element "TR" here (line 8)
Does anyone know why this error is happening?

You can't add a form element as a direct child of a <table> or <tr> element. Try surrounding the <table> with your <form>.

Related

Submit button not posting email [duplicate]

This question already has answers here:
HTML form email using mailto in form action doesnt work in Internet Explorer
(3 answers)
Closed 4 years ago.
I made a simple form to meet the needs on my website. It was as wanted, however, I am not able to use the "mailto" function to send the information provided by the user to my email.
After pressing the "send" button, no action is taken. can anybody help me?
NOTE: The form is HTML-only, no database usage, it's just an e-mail bridge.
<div class ="Formulario">
<div align="center">
<form id="form1" name="formulario" method="post" action="mailto:helpcelere#gmail.com">
<table width="200" height="250" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><input name="txt_nome" type="text" form="form1" placeholder="Nome" /></td>
</tr>
<tr>
<td><input name="txt_titulo" type="text" id="txt_titulo" form="form1" placeholder="Título do problema" titulo="txt_titulo" /></td>
</tr>
<tr>
<td><input name="txt_email" type="text" id="txt_email" form="form1" placeholder="Seu e-mail" email="txt_email" /></td>
</tr>
<tr>
<td><textarea cols="50" rows="8" form="form1" placeholder="Mensagem"></textarea></td>
</tr>
<tr>
<td><input type="submit" form="form1" formaction="mailto:helpcelere#gmail.com" formmethod="POST" value="enviar" /></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
try this instead
<div class ="Formulario">
<div align="center">
<form id="form1" name="formulario" method="post" action="mailto:helpcelere#gmail.com">
<table width="200" height="250" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><input name="txt_nome" type="text" form="form1" placeholder="Nome" /></td>
</tr>
<tr>
<td><input name="txt_titulo" type="text" id="txt_titulo" form="form1" placeholder="Título do problema" titulo="txt_titulo" /></td>
</tr>
<tr>
<td><input name="txt_email" type="text" id="txt_email" form="form1" placeholder="Seu e-mail" email="txt_email" /></td>
</tr>
<tr>
<td><textarea cols="50" rows="8" form="form1" placeholder="Mensagem"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="enviar" /></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>

Errors in validator

I, getting a lot of errors in validator but I don't understand the reasons of it.
end tag for "form" omitted, but OMITTAG NO was specified
required attribute "action" not specified
<div class="serch_block">
<form method="post" action="/search">
<table>
<tr>
<td>
<input type="text" class="form_in" name="search" value="" />
</td>
<td>
<input type="image" src="/design/img/button.jpg" name="submit" style="width:20px;height:19px;" onfocus='this.value="";' value="Поиск" />
</td>
</tr>
</table>
</form>
</div>
document type does not allow element "span" here; missing one of "th", "td" start-tag
<tr>
<td width="30" valign="top" align="right" class="text2" style="padding-top:10px;padding-right: 62px;">Email:</td>
<td><input type="text" class="form_in" name="email" /></td>
<span id="error_email" style="color:#ff0000;" class="<?php if(!isset($errors['email']))echo 'invisible';?>">Name and / or E-mail / are required!</span>
</tr>
Can you help me with it?
Here is the form.
<form action="/" method="post">
<table align="center" border="0">
<tr class="boss">
<td width="30" valign="top" align="left" class="text2news">Имя:
</td>
<td>
<input type="text" class="form_in" name="name" />
<span id="error_name" style="color:#ff0000" class="invisible"></span> </td>
<!--</td> -->
</tr>
<tr>
<td width="30" valign="top" align="right" class="text2" style="padding-top:10px;padding-right: 62px;">Email:</td>
<td ><input type="text" class="form_in" name="email" /></td>
<span id="error_email" style="color:#ff0000;" class="invisible">Имя и /или E-mail/ обязательны для заполенения!</span>
</tr>
<tr class="registrationBot">
<td><input type="submit" name="subscribe" value="подписаться" /></td>
<td><input type="submit" name="unsubscribe" value="отписаться" /><input type="submit" name="cleenerror" value="закрыть" /></td>
</tr>
<tr>
<td colspan="2" style="color:#ff0000"></td>
</tr>
</table>
</form>

Add form to table rows

Which is a valid way (if any) to add a form to table rows?
I have the following situation:
<table>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
How can I add a form element and still have valid HTML?
<table>
<form>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</form>
</table>
Is invalid (at least I think it is)
Wrap your table inside the form element:
<form action="/" name="form1">
<table>...</table>
</form>
But even better: Build your form without tables if possible.
Tables and forms are separate concepts in HTML. People sometimes confuse them with each other. The conceptual confusion is often accompanied with confused markup. On the other hand, tables and forms can be "mixed" in a sense. Specifically, you can put a table inside a form or vice versa, and it is often useful to do so. But you need to understand what you are doing.
Tables and forms can be nested either way. But if you put forms into tables, each form must be completely included into a single table cell (one TD element in practice). Thereby the forms are each completely independent.
AFAIK It is valid to use tables in order to format the form.
<form action="/" name="form1">
<table>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
or
<table>
<tr>
<td colspan="2"> <form action="/" name="form1"></td>
</tr>
<tr>
<td><input type="text" name="q"></td>
<td><input type="text" name="a"></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr><td colspan="2"> </form></td></tr>
......
</table>

resizing the background color of a form

if you try my code below you can see that the background color is light blue and it occupies the whole page of a site, I want to resize it how can you do that? I mean that the color will fit to the same size where the fill up boxes are,
do i need to add this code: width="60%"
can you please tell me where can I add this? Thanks
<html>
<div style="color:red">[+validationmessage+]</div>
<p style="color:#4C4C4C;font-weight:bold">« You can subscribe here: »</p>
<p>[+MailChimp.message+]</p>
<div style="background-color:#CCDFED">
<form method="post" action="[~[*id*]~]">
<br/>
<table>
<tr>
<td><label style="margin:0.5em"> Email: </label></td>
<td><input type="text" name="mc_EMAIL" size="60"
maxlength="60" style="margin:0.1em" value="" /></td>
</tr>
<tr>
<td><label style="margin:0.5em"> Name: </label></td>
<td><input type="text" name="mc_FNAME" size="60"
maxlength="60" style="margin:0.1em" value="" /></td>
</tr>
<tr>
<td><label style="margin:0.5em"> Last Name: </label></td>
<td><input type="text" name="mc_LNAME" size="60"
maxlength="60" style="margin:0.1em" value="" /></td>
</tr>
<tr>
<td><label style="margin:0.5em"> Website: </label></td>
<td><input type="text" name="mc_URL" size="60" maxlength="60"
style="margin:0.1em" value="" /></td>
</tr>
<tr>
<td><label style="margin:0.5em"> </label></td>
<td><input type="submit" name="subscribe" size="60"
maxlength="60" value="Register" /></td>
</tr>
</table>
</form>
<p><br/></p>
</div>
</html>
Try this:
<form method="post" action="[~[*id*]~]" style="display:inline-block;background-color:#CCDFEF">
Remove the <div style="background-color:#CCDFED"> before the form and </div> after it.

Using HTML::Template within a value attribute

my question is how would I use an HTML::Template tag inside a value of form field to change that field. For example
<table border="0" cellpadding="8" cellspacing="1">
<tr>
<td align="right">File:</td>
<td>
<input type="file" name="upload" value= style="width:400px">
</td>
</tr>
<tr>
<td align="right">File Name:</td>
<td>
<input type="text" name="filename" style="width:400px" value="" >
</td>
</tr>
<tr>
<td align="right">Title:</td>
<td>
<input type="text" name="title" style="width:400px" value="" />
</td>
</tr>
<tr>
<td align="right">Date:</td>
<td>
<input type="text" name="date" style="width:400px" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="button" value="Cancel">
<input type="submit" name="action" value="Upload" />
</td>
</tr>
</table>
I want the value to have a <TMPL_VAR> variable in it.
You use it the same way you'd use a template variable anywhere else:
<input type="text" name="date" style="width:400px" value="<TMPL_VAR NAME=date>" />
Yeah, it's ugly and it breaks your HTML validator. Which is one of the many reasons why I like Template Toolkit better.