Boolean field values in the Edit form
Posted: 20 Mar 2019
Hi, I have to buttons that I want to hide/show based on a checkbox Field in my form - I can get the value from the Boolean Field in the Display form but not in my Edit form. This is my code:
//Field "LederFerdig" is a checkbox - show/hide buttons if checked or not
function showHideButtons(){
var Sent = fd.field('LederFerdig').value();
alert(Sent);
if (Sent == 'true' ) {
$('.oppdateringbutton').show();
$('.ferdigbutton').hide();
}
else {
$('.oppdateringbutton').hide();
$('.ferdigbutton').show();
}
}
//call function on opening
showHideButtons();
The output form the alert(Sent) above is "true" or "false" but my condition if does not work (it always goes to the ELSE regardless of true/false value in the variable "Sent". Any thoughts?
//Field "LederFerdig" is a checkbox - show/hide buttons if checked or not
function showHideButtons(){
var Sent = fd.field('LederFerdig').value();
alert(Sent);
if (Sent == 'true' ) {
$('.oppdateringbutton').show();
$('.ferdigbutton').hide();
}
else {
$('.oppdateringbutton').hide();
$('.ferdigbutton').show();
}
}
//call function on opening
showHideButtons();
The output form the alert(Sent) above is "true" or "false" but my condition if does not work (it always goes to the ELSE regardless of true/false value in the variable "Sent". Any thoughts?