0
I have a problem, and I can’t fix it. I have a button that when you click on it displays a message to the confirmation user, it turns out that before opening this modal I would like to validate if all fields are filled.
For validation I am using lib Parsley
If I just use the simple button as below the validation is done successfully.
<button class="btn btn-primary" type="submit">Submit</button>
But if you use the button that calls the modal I cannot use the Validator before.
<button data-toggle="modal" data-target="#md-default" type="button" id="postar" class="btn btn-info btn-lg"><i class="fa fa-check"></i> <b>Enviar</b></button>
<!-- Modal -->
<div class="modal fade" id="md-default" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button " class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center">
<div class="i-circle primary"><i class="fa fa-check"></i></div>
<div class="confirmacao" id="confirmacao">
<h4>Confirma o envio do Push?</h4>
</div>
<div class="resp"></div>
<p></p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-flat" data-dismiss="modal" id="cancelButton" >Cancelar</button>
<button type="submit" class="btn btn-primary btn-flat enviar" id="submitButton" >Sim</button>
<button type="button" style="display: none" class="btn btn-default btn-flat" data-dismiss="modal" id = "closeButton">Fechar</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
put your javascript code too.
– RFL
does not have javascript code only use in the "required" input. <script src="js/jquery.Parsley/dist/Parsley.js" </script> <script src="js/jquery.Parsley/dist/i18n/pt-br.js"></script> <script type="text/javascript"> $(Document). ready(Function(){ window.ParsleyValidator.setLocale('en-br'); $('form'). Parsley(); }); </script>
– William