Re: [nbusers] WVP: Wacky listbox issues
Thanks!
lark
John Yeary wrote:
> Hello Lark,
>
> This looks like a common case where the user failed to set the
> selected value. For example
>
> 1. Create a new page
> 2. Add this code
>
> private Integer[] listYears;
>
> public Integer[] getListYears() {
> return listYears;
> }
>
> public void setListYears(Integer[] years) {
> this.listYears = years;
> }
>
> public Option[] getYears() {
> ArrayList<Option> l = new ArrayList<Option>();
> for (int i = 2006; i < 2015; i++ ) {
> l.add(new Option(new Integer(i), String.valueOf(i)));
> }
> return l.toArray(new Option[]{});
> }
>
> 3. In the prerender() method add this code
>
> if (listYears != null && listYears.length > 0 ) {
> for (Integer i : listYears) {
> info(i.toString());
> }
> }
>
> 4. Go to the vusual editor
> 5. Add a Message Group from the palette
> 6. Add a Button from the palette. (The button is just to submit the form)
> 7 Add a Listbox component from the palette
> 8. Right Click and Bind to data --> Years
> 9. Go to properties and bind selected to listYears[]
> 10. Check the Multiple checkbox
> 11.Run the project.
>
> When you run the project and select some values and submit you should
> see a message letting you know what was selected.
>
> If there is nothing for the component to bind to it will return the
> message you are seeing.
>
> Sincerely,
>
> John Yeary
>
> On 5/1/07, *Lark Fitzgerald* <Lark.Fitzgerald_at_sun.com
> <mailto:Lark.Fitzgerald_at_sun.com>> wrote:
>
> Does the woodstock team have any recommendations?
> Lark
>
> Don Lindsay wrote:
>> Hello;
>>
>> I have a table that contains a listbox. I have bound the
>> selected property to a function that returns an array. The
>> listbox is a multiple select. When the page renders I get an error:
>>
>> The current value of component XXXXXX does not match any of the
>> selections. did you forget to reset the value after changing the
>> options?
>>
>> This only occurs on table rows that have no selections in the
>> listbox.
>>
>> A side effect of this error is that the table will no longer
>> allow the user to move between pages of table records.
>>
>> When a listbox has no items selected my function returns null.
>> Should I return something else other than null?
>>
>> Thanks
>>
>> Don Lindsay
>> */_LQ Computer Consultants
>> _/*Email: don_at_lqcomp.com <mailto:don_at_lqcomp.com>
>
>
>
>
> --
> John Yeary
> --
> "If I have seen further, it is because I have stood on the shoulders
> of giants..." Sir Isaac Newton