Bloqueio de submit no PHP
Pessoal, bom dia
Sou novo com a programação PHP e estou precisando de uma ajuda
tenho o abaixo código e preciso adicionar mais essa parte para desabilitar o botao submit quando o usuario clicar:
document.getElementById(“btsubmit”).value = “Enviando dados…”;
document.getElementById(“btsubmit”).disabled = true;
return true;
porem não consegui fazer funcionar, ou ele não envia o formulario ou envia mas não desabilita, alguem pode me ajudar?
function valida(){
var ok = true;
LOAD=0;
if (!LOAD) {
//var ok = false;
var operador = <?php print $rowlogado['sis_atende']?>;
var unit = document.getElementById('idUnidade');
var tag = document.getElementById('idEtiqueta');
var sel_area = document.getElementById('idArea');
var sel_problema = document.getElementById('idProblema');
var descricao = document.getElementById('idDescricao');
var contato = document.getElementById('idContato');
//var carreg = '<?php //print $carrega?>';
if (ok) {
if (sel_area != null){
var ok = validaForm('idArea','COMBO','<?php print TRANS('OCO_FIELD_AREA')?>',1);
} //else ok = true;
}
if (ok) {
if (sel_problema != null){
var ok = validaForm('idProblema','COMBO','<?php print TRANS('OCO_FIELD_PROB')?>',1);
} //else ok = true;
}
if (ok) {
if (descricao != null){
var ok = validaForm('idDescricao','','<?php print TRANS('OCO_FIELD_DESC')?>',1);
} //else ok = true;
}
if (ok) {
if (unit != null){
if (operador == 0){
var ok = validaForm('idUnidade','COMBO','<?php print TRANS('OCO_FIELD_UNIT')?>',1);
} else ok = true;
} else ok = true;
}
if (ok) {
if (tag != null){
if (operador == 1){
var ok = validaForm('idEtiqueta','INTEIRO','<?php print TRANS('OCO_FIELD_TAG')?>',0);
} else {
var ok = validaForm('idEtiqueta','INTEIRO','<?php print TRANS('OCO_FIELD_TAG')?>',1);
}
} else ok = true;
}
if (ok) {
if (contato != null){
var ok = validaForm('idContato','','<?php print TRANS('OCO_FIELD_CONTACT')?>',1);
} else ok = true;
}
if (ok){
var fone = document.getElementById('idTelefone');
//if (carreg){
if (fone != null){
//var ok = validaForm('idTelefone','INTEIRO','ramal',1);
var ok = validaForm('idTelefone','FONE','<?php print TRANS('OCO_FIELD_PHONE')?>',1);
} else ok = true;
//}
}
if (ok){
var local = document.getElementById('idLocal');
//if (carreg){
if (local != null){
//var ok = validaForm('idTelefone','INTEIRO','ramal',1);
var ok = validaForm('idLocal','COMBO','<?php print TRANS('OCO_FIELD_LOCAL')?>',1);
} else ok = true;
//}
}
if (ok){
var replicate = document.getElementById('idReplicar');
if (replicate != null){
var ok = validaForm('idReplicar','INTEIROFULL','<?php print TRANS('OCO_FIELD_REPLICATE')?>',0);
} else ok = true;
}
if (ok){
var schedule = document.getElementById('idDate_schedule');
if (schedule != null){
var ok = validaForm('idDate_schedule','DATAHORA','<?php print TRANS('OCO_FIELD_SCHEDULE')?>',0);
} else ok = true;
}
}
return ok;
}Discussão (5)
Carregando comentários...