You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Marcelo Grassi Franco Melgaço <mg...@gmail.com> on 2008/12/19 10:58:58 UTC

Form Table

Hello,
i have a page with a FormTable.
The problem is that the submit button doesn't call the method in my page.
Here is the declaration of the submit on the constructor of the page:

this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
"onGravarClick"));

when i click on the button the page reloads, but the method onGravarClick is
not called.
Anyone know what can be the problem?
I'm using click-1.5

Thanks

Re: Form Table

Posted by Bob Schellink <sa...@gmail.com>.
Marcelo Grassi Franco Melgaço wrote:

> About the Master/detail pattern, do you have any example page who 
> implements that ?


Sure, the following are all Master/Details based:

http://www.avoka.com/click-examples/cayenne/cayenne-form-page.htm
http://www.avoka.com/click-examples/cayenne/tabbed-cayenne-form-page.htm
http://www.avoka.com/click-examples/table/edit-table.htm

Some like to master table at the top and detail below. But that is 
easy to change via the template :)

kind regards

bob

Re: Form Table

Posted by Marcelo Grassi Franco Melgaço <mg...@gmail.com>.
Hello Bob.
I resolved this calling the populate method in the oninit, thank you very
much for the help.
It was better to use the FormTable in this case, it's note a master/detail,
it's just a confirmation grid where the user can change some values before
persist to database.

About the Master/detail pattern, do you have any example page who implements
that ?

Thanks again


2008/12/19 Bob Schellink <sa...@gmail.com>

> Hi Marcelo,
>
> From the FormTable javadoc:
>
>   "When using the FormTable control its rowList property must be populated
> before the control
>    is processed so that any submitted data values can be applied to the
> rowList objects."
>
> Thus in order for the FormTable to process the Field values and apply it to
> the Table rows, the rows must be available during the onProcess phase.
> The only way is to populate the FormTable during the onInit phase.
>
> There are ways around it for example you could manually invoke
> FormTable#onProcess() in the listener after you set the FormTable rows.
>
> Why do you need to populate the FormTable from the listener? Are there
> certain conditions you need to check?
>
> If there is you could check for the conditions in the onInit method:
>
>   public void onInit() {
>     //manually process the button to see if it was clicked
>     myButton.onProcess()
>
>     if(myButton.isClicked()) {
>       // specify conditions
>       // populate FormTable
>     }
>   }
>
> Alternatively instead of using the bulk edit FormTable pattern instead look
> at using a Master/Detail pattern?
>
>
> kind regards
>
> bob
>
>
>
> On Fri, Dec 19, 2008 at 12:38 PM, Marcelo Grassi Franco Melgaço <
> mgfranco@gmail.com> wrote:
>
>> Hi, i resolved the problem.
>> Now i have another.
>> The Formtable.getRowList() is empty in my submit method.
>> The formtable is populated when the user click on a button.
>> I saw in the examples that the formtable must be populated in the onInit
>> method.
>> How can i can populate the formtable when the user click on a button?
>>
>> Thanks
>>
>>
>> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
>>
>> Hello,
>>> i have a page with a FormTable.
>>> The problem is that the submit button doesn't call the method in my page.
>>> Here is the declaration of the submit on the constructor of the page:
>>>
>>> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
>>> "onGravarClick"));
>>>
>>> when i click on the button the page reloads, but the method onGravarClick
>>> is not called.
>>> Anyone know what can be the problem?
>>> I'm using click-1.5
>>>
>>> Thanks
>>>
>>
>>
>>
>> --
>> Marcelo Grassi
>> www.rumotecnologia.com.br
>> (31) 9307-1268
>>
>
>
>
> --
> http://incubator.apache.org/click/
>



-- 
Marcelo Grassi
www.rumotecnologia.com.br
(31) 9307-1268

Re: Form Table

Posted by Bob Schellink <sa...@gmail.com>.
Hi Marcelo,

>From the FormTable javadoc:

  "When using the FormTable control its rowList property must be populated
before the control
   is processed so that any submitted data values can be applied to the
rowList objects."

Thus in order for the FormTable to process the Field values and apply it to
the Table rows, the rows must be available during the onProcess phase.
The only way is to populate the FormTable during the onInit phase.

There are ways around it for example you could manually invoke
FormTable#onProcess() in the listener after you set the FormTable rows.

Why do you need to populate the FormTable from the listener? Are there
certain conditions you need to check?

If there is you could check for the conditions in the onInit method:

  public void onInit() {
    //manually process the button to see if it was clicked
    myButton.onProcess()

    if(myButton.isClicked()) {
      // specify conditions
      // populate FormTable
    }
  }

Alternatively instead of using the bulk edit FormTable pattern instead look
at using a Master/Detail pattern?


kind regards

bob


On Fri, Dec 19, 2008 at 12:38 PM, Marcelo Grassi Franco Melgaço <
mgfranco@gmail.com> wrote:

> Hi, i resolved the problem.
> Now i have another.
> The Formtable.getRowList() is empty in my submit method.
> The formtable is populated when the user click on a button.
> I saw in the examples that the formtable must be populated in the onInit
> method.
> How can i can populate the formtable when the user click on a button?
>
> Thanks
>
>
> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
>
> Hello,
>> i have a page with a FormTable.
>> The problem is that the submit button doesn't call the method in my page.
>> Here is the declaration of the submit on the constructor of the page:
>>
>> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
>> "onGravarClick"));
>>
>> when i click on the button the page reloads, but the method onGravarClick
>> is not called.
>> Anyone know what can be the problem?
>> I'm using click-1.5
>>
>> Thanks
>>
>
>
>
> --
> Marcelo Grassi
> www.rumotecnologia.com.br
> (31) 9307-1268
>



-- 
http://incubator.apache.org/click/

Re: Form Table

Posted by Marcelo Grassi Franco Melgaço <mg...@gmail.com>.
Ok man, thanks anyway

2008/12/19 Gilberto C. Andrade <gi...@gmail.com>

> Sorry,
> I did see just this: "I saw in the examples that the formtable must be
> populated in the onInit method."
> So, I think it was to init the page.
>
> Gilberto
>
> 2008/12/19 Gilberto C. Andrade <gi...@gmail.com>:
> > I use this method:
> > [code]
> >   /**
> >      * @see net.sf.click.Page#onRender()
> >      */
> >     public void onRender() {
> >         log.debug("Preparando a página para ser exibida.");
> >         List uMs = (List) getIService().findLike("descricao_unidade",
> > "%"+descricaoUnidadeField.getValue()+"%");
> >         table.setRowList(uMs);
> >     }
> > [/code]
> >
> > 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
> >>
> >> Hi, i resolved the problem.
> >> Now i have another.
> >> The Formtable.getRowList() is empty in my submit method.
> >> The formtable is populated when the user click on a button.
> >> I saw in the examples that the formtable must be populated in the onInit
> >> method.
> >> How can i can populate the formtable when the user click on a button?
> >>
> >> Thanks
> >>
> >>
> >> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
> >>>
> >>> Hello,
> >>> i have a page with a FormTable.
> >>> The problem is that the submit button doesn't call the method in my
> page.
> >>> Here is the declaration of the submit on the constructor of the page:
> >>>
> >>> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
> >>> "onGravarClick"));
> >>>
> >>> when i click on the button the page reloads, but the method
> onGravarClick
> >>> is not called.
> >>> Anyone know what can be the problem?
> >>> I'm using click-1.5
> >>>
> >>> Thanks
> >>
> >>
> >>
> >> --
> >> Marcelo Grassi
> >> www.rumotecnologia.com.br
> >> (31) 9307-1268
> >
> >
>



-- 
Marcelo Grassi
www.rumotecnologia.com.br
(31) 9307-1268

Re: Form Table

Posted by "Gilberto C. Andrade" <gi...@gmail.com>.
Sorry,
I did see just this: "I saw in the examples that the formtable must be
populated in the onInit method."
So, I think it was to init the page.

Gilberto

2008/12/19 Gilberto C. Andrade <gi...@gmail.com>:
> I use this method:
> [code]
>   /**
>      * @see net.sf.click.Page#onRender()
>      */
>     public void onRender() {
>         log.debug("Preparando a página para ser exibida.");
>         List uMs = (List) getIService().findLike("descricao_unidade",
> "%"+descricaoUnidadeField.getValue()+"%");
>         table.setRowList(uMs);
>     }
> [/code]
>
> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
>>
>> Hi, i resolved the problem.
>> Now i have another.
>> The Formtable.getRowList() is empty in my submit method.
>> The formtable is populated when the user click on a button.
>> I saw in the examples that the formtable must be populated in the onInit
>> method.
>> How can i can populate the formtable when the user click on a button?
>>
>> Thanks
>>
>>
>> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
>>>
>>> Hello,
>>> i have a page with a FormTable.
>>> The problem is that the submit button doesn't call the method in my page.
>>> Here is the declaration of the submit on the constructor of the page:
>>>
>>> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
>>> "onGravarClick"));
>>>
>>> when i click on the button the page reloads, but the method onGravarClick
>>> is not called.
>>> Anyone know what can be the problem?
>>> I'm using click-1.5
>>>
>>> Thanks
>>
>>
>>
>> --
>> Marcelo Grassi
>> www.rumotecnologia.com.br
>> (31) 9307-1268
>
>

Re: Form Table

Posted by "Gilberto C. Andrade" <gi...@gmail.com>.
I use this method:
[code]
  /**
     * @see net.sf.click.Page#onRender()
     */
    public void onRender() {
        log.debug("Preparando a página para ser exibida.");
        List uMs = (List) getIService().findLike("descricao_unidade",
"%"+descricaoUnidadeField.getValue()+"%");
        table.setRowList(uMs);
    }
[/code]

2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>

> Hi, i resolved the problem.
> Now i have another.
> The Formtable.getRowList() is empty in my submit method.
> The formtable is populated when the user click on a button.
> I saw in the examples that the formtable must be populated in the onInit
> method.
> How can i can populate the formtable when the user click on a button?
>
> Thanks
>
>
> 2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>
>
> Hello,
>> i have a page with a FormTable.
>> The problem is that the submit button doesn't call the method in my page.
>> Here is the declaration of the submit on the constructor of the page:
>>
>> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
>> "onGravarClick"));
>>
>> when i click on the button the page reloads, but the method onGravarClick
>> is not called.
>> Anyone know what can be the problem?
>> I'm using click-1.5
>>
>> Thanks
>>
>
>
>
> --
> Marcelo Grassi
> www.rumotecnologia.com.br
> (31) 9307-1268
>

Re: Form Table

Posted by Marcelo Grassi Franco Melgaço <mg...@gmail.com>.
Hi, i resolved the problem.
Now i have another.
The Formtable.getRowList() is empty in my submit method.
The formtable is populated when the user click on a button.
I saw in the examples that the formtable must be populated in the onInit
method.
How can i can populate the formtable when the user click on a button?

Thanks


2008/12/19 Marcelo Grassi Franco Melgaço <mg...@gmail.com>

> Hello,
> i have a page with a FormTable.
> The problem is that the submit button doesn't call the method in my page.
> Here is the declaration of the submit on the constructor of the page:
>
> this.tableEvolucao.getForm().add(new Submit("gravar", "Gravar", this,
> "onGravarClick"));
>
> when i click on the button the page reloads, but the method onGravarClick
> is not called.
> Anyone know what can be the problem?
> I'm using click-1.5
>
> Thanks
>



-- 
Marcelo Grassi
www.rumotecnologia.com.br
(31) 9307-1268