8
I need to do just that:
In case the user click No, system closes the message and keeps the existing information on the screen.
On the screen there is a button limpar
and he calls the function acaoLimpar()
but without displaying a dialog box, simply clears all fields. Now with this new rule, as I put two buttons on one alert()
and do what is written? Below the function acaoLimpar()
:
function AcaoLimpar() {
$("#txt_dt_ref_inicial").val("");
$("#txt_dt_ref_final").val("");
$("#ddl_tipotabela").val("");
$("#txt_tabela").val("");
$("#txt_classificacao").val("");
$("#txt_grupo").val("");
$("#ddl_autorizacaoprevia").val("");
limparAutoComplete();
}
function limparAutoComplete() {
var arrayTemp = [];
sessionStorage.setItem("tabelas", arrayTemp);
sessionStorage.setItem("classificacoes", arrayTemp);
sessionStorage.setItem("grupos", arrayTemp);
CarregarGridTabela(arrayTemp);
CarregarGridClassificacao(arrayTemp);
CarregarGridGrupo(arrayTemp);
}
When executing the codex below it works, however generates button OK
and Cancelar
and by the rule should be: SIM
and NÃO
function AcaoLimpar() {
decisao = confirm('Deseja realmente limpar os dados?')
if (decisao) {
$("#txt_dt_ref_inicial").val("");
$("#txt_dt_ref_final").val("");
$("#ddl_tipotabela").val("");
$("#txt_tabela").val("");
$("#txt_classificacao").val("");
$("#txt_grupo").val("");
$("#ddl_autorizacaoprevia").val("");
limparAutoComplete();
}
else
return false;
}
Using confirm
, there is how to change the OK
for Sim
and Cancelar
for Não
?
Following the example of colleague Tobymosque, I did this, but my browser is old. Everything should be validated from the IE 7. Gave error in past includes. Does not accept the attrProp
.
function AcaoLimpar() {
alert(1);
var msgExcluir = $("#msgExcluir");
msgExcluir.dialog({
modal: true,
buttons: {
"Sim": function () {
//alert("Excluido com Sucesso");
$("#txt_dt_ref_inicial").val("");
$("#txt_dt_ref_final").val("");
$("#ddl_tipotabela").val("");
$("#txt_tabela").val("");
$("#txt_classificacao").val("");
$("#txt_grupo").val("");
$("#ddl_autorizacaoprevia").val("");
limparAutoComplete();
$(this).dialog('close');
},
"Não": function () {
return false;
$(this).dialog('close');
}
}
});
}
Can’t you use a reset input? It does the same as its function.
– Cobra
I edited the original post
– pnet
You can use the jQuery-UI Dialog or so many others.
– Pedro Camara Junior