0
I would like the fields not to be sent in empty, so I tried using the required.. but it is not working. What is the reason why?
<form action="https:/----Site---" method="POST">
<input type=hidden name="oid" value="00Dj0000001qrSu">
<input type=hidden name="retURL" value="http://-----/?msg=ok">
<input type=hidden name="lead_source" value="Formulário Site">
<table>
<tr>
<td>
<input type="text" name="first_name" placeholder="Nome:" maxlength="250" required="required" />
</td>
<td>
<input type="text" name="email" placeholder="E-mail:" maxlength="250" required="required" />
</td>
</tr>
<tr>
<td>
<input type="text" name="company" placeholder="Empresa:" maxlength="250" required="required" />
</td>
<td>
<input type="text" name="phone" placeholder="Telefone:" maxlength="250" required="required" />
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="description" placeholder="Mensagem/Comentários:" rows="4" required="required"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="enviar" value="Enviar" />
</td>
</tr>
</table>
</form>
try to put required="required"
– Thiago Friedman
This code is inside a form ? How is the request being sent ? Could you publish the whole form ?
– Mayllon Baumer
I did the editing to make it clearer.
– Guilherme Lima
Thiago, it didn’t work.
– Guilherme Lima
What doesn’t work? Can it send the form even with a blank value? Is that it? Or it doesn’t send anything from the form?
– celsomtrindade
I tested your code and it apparently worked, what is the result ? It at least points out that the field is not filled in ?
– Mayllon Baumer
Can even send the form when it is empty
– Guilherme Lima
Mayllon he does not point out that the field is blank, simply sends the message normally.
– Guilherme Lima
If you want to let your code dry, instead of repeating
required="required"
in all form fields, if you use jQuery on your page, just put a line of script so that all fields haverequired
:$("form *").attr("required","required");
.– Sam
@Dvdsamm the problem has already been solved in response, the AP browser was not supported yet.
– Guilherme Nascimento