1
The validation of jquery.validate.js
only works when the input
this one inside <div class="form-group">
, for example if I put the code:
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-log-in"></i>
<input id="id_codigo_empresa" name="codigo_empresa"
type="number" class="form-control" maxlength="6"
placeholder="Código da entidade" required>
</div>
</div>
</div>
If you leave the input
empty and click the button Submit it does not show the message 'Campo requerido'
on screen, but if I do:
<div class="form-group">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-log-in"></i>
<input id="id_codigo_empresa" name="codigo_empresa"
type="number" class="form-control" maxlength="6"
placeholder="Código da entidade" required>
</div>
</div>
</div>
</div>
Adding a div
with form-group
works, but I don’t want to use the form-group
because it takes formatting from the field and then changes the design.
Is there any way to use the validator without the form-group
?
Just to complement, it validates, but does not display the message without the form-group
.
If I add my style modifications to the form group, it gets kind of bizarre. below field image with the form-group and without it, see that the input has become square and no edges and as had decreased the margin-Botton the error label is behind the input.
You can provide a Fiddle example using these bootstrap classes with Validator?
– Marcos Henzel
You said: "Just to complement, it validates, but does not display the message without the
input-group
.", Have you checked what this class does in the fields? Give a check onarquivo.css
, where there’s this class, try inspect the page elements (F12), to see how the page is being mounted.– Marcos Henzel
instead of you trying to take the div form group, why not try to give a ! Important in your own css style? this way the form will not be disfigured as you said
– Bsalvo
@Brunocastro , I tried but it’s kind of bizarre, I posted an image
– Gleyson Silva