UI Only Picklist not showing value

  • 1
  • Question
  • Updated 2 years ago
  • In Progress
  • (Edited)
UI Only picklist with manually created entries not displaying values on the page. I have a pageload snippet that loops through the picklistEntries and identifies one that matches a field on the record. I set that as the selectedItem, but nothing shows up on the actual page.

var uionlyPicklist = termModel.getField('UIOnlyPicklist');
       for(var index = 0; index < uionlyPicklist .picklistEntries.length; index++) {
            if(uionlyPicklist .picklistEntries[index].value == newPicklistValue) {
                uionlyPicklist .selectedIndex = index;
            }
       }

 newPicklistValue is the value retrieved from another field on the model.
Photo of Jerry

Jerry

  • 1,150 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Jerry

Jerry

  • 1,150 Points 1k badge 2x thumb
I've been poking away at this for a day now, it seems like until I try to edit it on the page it is showing up as undefined when I search for it on the model. Even though I am attempting to assign a value to it.
Photo of Jerry

Jerry

  • 1,150 Points 1k badge 2x thumb
I am setting both the value of this field and the selectedIndex. Both show up when I pull the row and field up in the console, but I cannot see them on the page. I tried putting this in a render snippet, but that makes it so I can't even edit the field to get it to show up.....
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Jerry,

Are you trying to 'preset' the UI only field on page load?  Why not update the value of the UI Only field instead of trying to set the picklist item to show?

Thanks,

Bill