Hi Alwyn,

My guess is that the Select control is named "selection" but the rendered Select is named "admissibilityValue". So when the Form is submitted there is no "selection" request parameter, and nothing is bound.

What happens if you rename the Select control to "admissibilityValue"?

kind regards

bob


alwynn wrote:
Hi

I've got a class that extends FormTable. On the Formtable I add a
FieldColumn with a Select component as the field.
I implement a Decorator on this FieldColumn since I need to determine and
manipulate the selected value based on a request attribute.

The problem is that the selected value is never bound to the form. When I call getRowList I retrieve values for the other columns (using
FieldColumn and Column but no decorator)

It seems like when I implement a Decorator on a FieldColumn the bounding of
the value gets lost.
I've made sure of the following:
1) The FormTable is constructed in the page's onInit
2) The Select is bindable with an annotation - not sure if this is actually
necessary since the FieldColumn itself is bounded.

Here is the code for the FormTable [This all happens in the constructor]

@Bindable
Select selection = new Select("selection");
selection.addAll(someCollection,"label","label");

FieldColumn selectionColumn = new
FieldColumn("admissibilityValue","Admissability", selection);
selectionColumn .setDecorator(new Decorator() {
            int i = -1;
            public String render(Object object, Context context) {
                MyValueObject vo= (MyValueObject )object;
                
                i++;
                StringBuffer htmlBuffer = new StringBuffer("");
                htmlBuffer.append("<select name='admissibilityValue_" + i + "'
id='table_form_admissibilityValue_" + i + "' size='1' width='100%'>");
                Iterator<TimeTypeAdmissibility> ttaList = c.iterator();
                TimeTypeAdmissibility selected = null;
                List<String> values = new ArrayList<String>();
                
                while(ttaList.hasNext()) {
                    TimeTypeAdmissibility tta = ttaList.next();
                    htmlBuffer.append("<option ");
                                if (null == 
context.getRequest().getParameter("admissibilityValue_" +
i)) {
                                    if(vo.getAdmissibility().compareTo(tta)==0) 
{
                                        htmlBuffer.append("selected='true' ");
                                        
                                    }
                                } else if
(tta.getLabel().equalsIgnoreCase(context.getRequest().getParameter("admissibilityValue_"
+ i))) {
                                    admis.setAttribute("selected", "true");
}
                        htmlBuffer.append("value='" + tta.getLabel() + "'>" 
+tta.getLabel() +
"</option>");
                }

                return htmlBuffer.toString();
            }
        });

        addColumn(selection);

Any suggestions?

Thank you
Aly


Reply via email to