3
I have problems with the field that I disable if one of the options is checked, but when the field is as desabled
it does not pass values to PHP.
I would like to know how to check whether the value exists or not, and if it does not exist set to null.
I tried to make several ways but the same mistake happens:
PHP Notice: Undefined index: f_DAT_FINAL_VINCU
Attempts were:
$campos[':DAT_FINAL_VINCU'] = ((isset($_POST['f_DAT_FINAL_VINCU'])) ? eglise_dataDeDMAParaAMD($_POST['f_DAT_FINAL_VINCU']) : null );
$campos[':DAT_FINAL_VINCU'] = strlen(eglise_dataDeDMAParaAMD($_POST['f_DAT_FINAL_VINCU'])) === 0 ? null : htmlspecialchars($_POST['f_TXT_DESCR_VINCU'], ENT_QUOTES);
$campos[':DAT_FINAL_VINCU'] = strlen(eglise_dataDeDMAParaAMD($_POST['f_DAT_FINAL_VINCU'])) === null ? null : htmlspecialchars($_POST['f_TXT_DESCR_VINCU'], ENT_QUOTES);
How should I do ?
I’m putting the field via jquery but it’s not working look how I do:
var variavel = $('#f_FLG_STATU_VINCU').val();
if (variavel == "A") {
$('#f_DAT_FINAL_VINCU').val(null);
}
$('#f_FLG_STATU_VINCU').change(function () {
var variavel = $(this).val();
var today = new Date();
if (variavel == "A") {
$('#f_DAT_FINAL_VINCU').val(null);
$('#f_DAT_FINAL_VINCU').prop("readonly", true);
} else {
$('#f_DAT_FINAL_VINCU').prop("readonly", false);
$('#f_DAT_FINAL_VINCU').datepicker("setDate", today);
}
});
readonly passa disabled already says field disabled
– Otto
difference between readonly and disabled
– rray
Still not working, look at my edition
– Renan Rodrigues
@rray how will my $fields['] array look? Because if the value is empty you need to set it to null
– Renan Rodrigues
Check whether the array element or the inner array is
empty
:if(empty($array))
orif(empty($array['posicao']))
and arrow likenull
– Leonardo
Vlw, it worked out !
– Renan Rodrigues