Try this:
List choices;
if(<empty_condition>){
choices = new ArrayList();
}
else{
choices = ....
}
DropDownChoice d = new DropDownChoice("drop", new
PropertyModel(this,"drop"), choices) {
protected void onComponentTagBody(final MarkupStream
markupStream, final ComponentTag openTag)
{
Object list =getChoices();
if(list instanceof List){
int size = ((List)list).size();
if(size > 0){
super.onComponentTagBody
(markupStream,openTag);
}
else{
replaceComponentTagBody(markupStream, openTag,
new AppendingStringBuffer());
}
}
else{
super.onComponentTagBody(markupStream,openTag);
}
}
};
-swaroop
On 10/11/07, Matt Jensen <[EMAIL PROTECTED]> wrote:
>
>
> Is there any way to get a ListChoice to render as empty (no options)
> when its choice model is empty? By default, "Choose One" appears. If I
> set nullValid to true, an empty item appears which is still selectable.
> I would like to have the list come up completely empty if the choice
> model is empty, and I'd like to do it without creating a new component
> (though obviously I will do that if it is what is needed.)
>
> --Matt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>