Garbage Value in Custom Picker

Certified Associate Developer
Hi Everyone

I’m using a custom picker as a user picker to select users based on custom properties. However, I’ve run into an issue:
      •     If I type something in the picker but then erase it without selecting a suggestion, the field ends up holding a garbage or null value.
      •     This behavior causes unexpected results in my form/data submission.
Has anyone faced a similar issue? If so, what’s the best way to handle it — for example, ensuring the field resets properly or validating before submission?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    In selectedLabels,use
    if(isnull(local!selectedUser), {}, {local!selectedUser.name})
    to return empty list instead of {null}, and in saveInto add
    if(or(isnull(save!value), length(save!value)=0), a!save(local!selectedUser, null), ...)
    to clear when text is erased.

    Add validations to check if typed text matches valid selection, and disable submit button with disabled: isnull(local!selectedUser) to prevent submission.

Reply
  • 0
    Certified Lead Developer

    In selectedLabels,use
    if(isnull(local!selectedUser), {}, {local!selectedUser.name})
    to return empty list instead of {null}, and in saveInto add
    if(or(isnull(save!value), length(save!value)=0), a!save(local!selectedUser, null), ...)
    to clear when text is erased.

    Add validations to check if typed text matches valid selection, and disable submit button with disabled: isnull(local!selectedUser) to prevent submission.

Children
No Data