Home Forums Presentation Forms Defaulting a Query Combo Box to a Non-Null Selection

This topic contains 2 replies, has 2 voices, and was last updated by Dhruv Bassi Dhruv Bassi 1 year, 2 months ago.

  • Author
    Posts
  • #10512
    Ryan Herbeck
    Ryan Herbeck
    Participant

    I have a query list form with a set of text fields and combo boxes for search criteria. I am looking to default a query combo box to a non-null selection when a user first views the query list or when the search criteria is cleared. Is there an existing configuration function that would allow the setup of this default behavior?

    0
  • #10520
    Dhruv Bassi
    Dhruv Bassi
    Moderator

    Hi Ryan,

    From my experience there is no specific function/property to default the value for the combo.

    However you can achieve it by doing below:

    • For the initial load of the form/screen
      • In the script tab, create PostMessage function (which gets executed after the UI is rendered)
      • In the postMessage find your combo box and set the value
        • Using findViewpath , “value” is what you want to set
    • Above can be wrapped in a function which then can be called from a data action/ui action when “clearing” the search criteria.

    Hope that helps.

    Regards,
    Dhruv

    0
  • #10528
    Dhruv Bassi
    Dhruv Bassi
    Moderator

    The defaulting of combo is mostly achieved by setting the initializer of the attribute it’s bound to, but this only works in Add/Edit scenarios not search/query forms.

    Below is how you would set the default selection on a combobox

    (define defaultValue “test”) <– Not this will most probably be the enum object

    (define comboModel ((this’findView ‘(filterCombo))’collectionModel))
    (comboModel’currentIndex (comboModel’find defaultValue))

    0

You must be logged in to reply to this topic.