2
Friends, I would like to know how to remotely recover text from PHP messages in jquery.validate.
$('#ajax_form_inclusao').validate({
rules : {
numeroContrato : {
required : true
},
dataInicial : {
required : true,
dateTimeBR : true
},
dataFinal : {
required : true
},
valorPF : {
required : true
},
qtdPFContratado : {
required : true
},
status : {
required : true
}
},
messages : {
numeroContrato : {
required : errorMessages.E2
},
dataInicial : {
required : 'Preencha o campo Data Inicial'
},
dataFinal : {
required : 'Preencha o campo Data Final'
},
valorPF : {
required : 'Preencha o campo ValorPF'
},
qtdPFContratado : {
required : 'Preencha o campo Quantidade de PF Contratado'
},
status : {
required : 'Selecione uma opção para o campo Status'
}
},
submitHandler : function(form) {
I would just like to put all the system messages in a single central file and recover the text of the messages in the scripts.
I have a question so I can give you the best possible answer. What is the purpose of receiving the text of validate php? You want to make it easier to handle these errors in php?
– Erlon Charles
@Erloncharles He wants to have the error messages centralized so he doesn’t have to rewrite it on the server-side.
– Guilherme Oderdenge
The ideal would be to have centered on server and carry them on client, so it’s a much better way to maintain, otherwise it’s much less efficient and complicated to maintain.
– Erlon Charles