I have this method that is run on the momento of the form construction
The List<Categoria> keyValuePairsTemp stores the values of the DropDown
private DropDownChoice criaCategoriaPaiDropdown() {
setOutputMarkupId(true);
choiceRenderer = new CategoriaChoiceRenderer();
getHibernateTransaction();
List<Categoria> keyValuePairsTemp = (List<Categoria>) CategoriaDAO
.getAllCategorias(hibernateSession);
Categoria categoria = null;
// Trata o caso de não existir categoria cadastrada
if (keyValuePairsTemp.size() < 1) {
categoria = new Categoria();
} else {
categoria = keyValuePairsTemp.get(0);
}
PropertyModel categoriaPaiModel = new PropertyModel(categoria,
"categoriaPai");
categoriaPai = new DropDownChoice("categoriaPai", categoriaPaiModel,
keyValuePairsTemp, choiceRenderer);
return categoriaPai;
}
On Mon, Feb 16, 2009 at 11:06 AM, Eyal Golan <[email protected]> wrote:
> Where do yo u have the values in the DropDown in the first place?
> If you use a model, why not updating it?
>
>
> Eyal Golan
> [email protected]
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>
>
> On Mon, Feb 16, 2009 at 2:13 PM, Daniel Ferreira Castro
> <[email protected]>wrote:
>
> > I read the examples of Ajax Forms and I am trying to adapt it to my
> needs.
> > I have a form with a input text, a drop down box, a feedback panel and a
> > submit button.
> >
> > My submit is an ajaxButton.
> > My form setsOutputMarkupId(true);
> > My dropdown sets OutputMarkupId(true);
> >
> > When I submit my form it inserts an item on a table.
> > My intention is after the form submit the dropdown uptades itself, adding
> > the previously inserted item to its options.
> >
> > how to do it?
> >
> > --
> > "Two rules to succeed in life:
> > 1 - don´t tell people everything you know."
> > --------
> > We shall go on to the end.
> > We shall fight in France
> > We shall fightover the seas and oceans.
> > We shall fight with growing confidence and growing strength in the air.
> > We shall defend our island whatever the cost may be
> > We shall fight on beaches, we shall fight on the landing grounds,
> > We shall fight in the fields and in the streets,
> > We shall fight on the hills.
> > We shall never surrender.
> > Winston Churchill
> >
>
--
"Two rules to succeed in life:
1 - don´t tell people everything you know."
--------
We shall go on to the end.
We shall fight in France
We shall fightover the seas and oceans.
We shall fight with growing confidence and growing strength in the air.
We shall defend our island whatever the cost may be
We shall fight on beaches, we shall fight on the landing grounds,
We shall fight in the fields and in the streets,
We shall fight on the hills.
We shall never surrender.
Winston Churchill