How to force refresh of a list box when form loads

I have a form with multiple drop down combo list boxes, each with a data table as a source

The contents of each list box is dependent on the previous selection.

Whilst I have this working more or less, I would like the form to load all the list boxes with relevant data when the form loads and is first displayed.

Is there a way to do that?

Re: How to force refresh of a list box when form loads

Lock at the sample video: “Ajax Events”

Re: How to force refresh of a list box when form loads

Thanks, I’ll revisit that but the form is already using AJAX to refresh other dependencies when the value changes. My problem is that initially the first box may only have a single value, so the value cannot change. In turn, the dependent lists are not refreshed.

I hope that explanation makes sense(?)

Re: How to force refresh of a list box when form loads

Hhm, your problem is not clear …

In your form you select many items in combox boxes and save that record. Reloading the record shows not the correct values in the combox boxes?

or

Your have a blank record and the combo boxes shows all but not the right items (dependent to other combox boxes)?

Please explain more …

Re: How to force refresh of a list box when form loads

First off, I have followed the AJAX video example to set up two combo list boxes on a form. The second combo list box criteria is provided by combo list box 1.

The problem is:

  • Assume the data source for the combo list box 1 contains just one record.

  • When the form opens, the first and only record is selected and displayed.

  • Combo List Box 2 has several records that can be selected & displayed based on the criteria provided by combo list box 1

The problem is that when the form opens combo list box 2 does not display any data. I suspect the generated code is structured for an input on combo list box one on the data changed event. In other words, the user is expected to make a selection from the first combo list box before the refresh on combo list box 2 is triggered.

However, since there is only one record in combo list box 1, the data changed event cannot be triggered, so the data refresh on combo 2 cannot occur.

PS: It works OK when combo list box has TWO or more records, so maybe this is more of a bug in the code generation. There are a few other things I have noticed that suggest the AJAX code generated does not function adequately for more complex forms, such as when the form has several combo list box, each dependent on the previous one providing data selection criteria.

Hi GuiGuy,
You can ‘force’ refresh a list box when form loads in scriptcase. Please follow these steps:

[SIZE=4]Solution #1[/SIZE]
Set a value of combobox1 onLoad event.

{combobox1}=1;

Note: Value of combobox1 onLoad event must exist.

[SIZE=4]Solution #2[/SIZE]
[LIST=1]

  • Select your combobox1 and change [B]'Use title'[/B] to 'Yes',
  • then type on [B]'Title'[/B] something like this '-- None --' and [B]'Title internal value'[/B] to '0' [/LIST]

    Note: Now your combobox1 will show a title before your lookup.

  • 1 Like

    Re-upping this old thread in case someone else has this issue.
    To get the Secondary Listbox to populate when you open a New record, you have to set the Initial Value of the First ListBox .
    Select the Field of the First Listbox, under General Settings… Initial Value . Set it as defined then enter what you want the initial Listbox to be… now the 2nd Listbox will have data when you open a New record form