Page 1 of 1

Boolean field values in the Edit form

Posted: 20 Mar 2019
by TomGullberg
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?

Re: Boolean field values in the Edit form

Posted: 21 Mar 2019
by AlexZver
Dear Tom,

Please try this code for the Edit Form:

Code: Select all

function showHideButtons(){
    var Sent = fd.field('LederFerdig').value();
    if (Sent) {
        $('.oppdateringbutton').show();
        $('.ferdigbutton').hide();
    } else {
        $('.oppdateringbutton').hide();
        $('.ferdigbutton').show();
    }
}