Skip to main content
Nintex Community Menu Bar
Question

unable to initialize the value of a ui-only checkbox field.

  • July 10, 2024
  • 1 reply
  • 0 views
  • Translate

Forum|alt.badge.img+1

I have a UI field “boolIsPlanSelected” which is defaulted to “false” i.e. checkbox unchecked.
I am using this field just to toggle between the images of checked and unchecked checkbox. So when a user clicks an unchecked checkbox, the image should be flipped to a checked one and vice versa.

On the page load, the image of unchecked checkbox should be present, which requires me to check the value of this ui-only field in the rendering section of the image.

Now when i console.log the value of the ui-only field in the js snippet that runs on the click of the unchecked checkbox image, the value of the ui-only field is found to be “null”.Why is the Default value not being considered?

var selectedItem = arguments[0].item,
    selectedList = arguments[0].list,
    selectedModel = arguments[0].model,
    selectedPlanRow = selectedItem.row;
    console.log('selectedPlanRow.boolIsPlanSelected = '+selectedPlanRow.boolIsPlanSelected);
    if(selectedPlanRow.boolIsPlanSelected){
        selectedPlanRow.boolIsPlanSelected = false;
    }
    else{
        selectedPlanRow.boolIsPlanSelected = true;
    }
    console.log('selectedPlanRow.boolIsPlanSelected 2 = '+selectedPlanRow.boolIsPlanSelected);



Did this topic help you find an answer to your question?
This topic has been closed for comments

Forum|alt.badge.img+3

Hi Rahul!

I just answered your other question - and hopefully you have this all working now.  The UI-Only field default values only applies to new records, and not existing records.  In your use case, I would check to see if the checkbox is either null or false, and render based on that value.  A null value would just represent an existing record where the UI-Only field hasn’t ever been set to true.

Hope this fixes it!
Christine

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings