You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2012/04/10 09:30:31 UTC
Re: dynamic wizard - update model
Hi,
On Mon, Apr 9, 2012 at 6:50 PM, Frederico Rodrigues
<fr...@ano.pt> wrote:
> Hello
>
> I have implement wicket wizard, but i have a small problem, i have an
> ajaxbutton and i want update the model, but only have success with this when
> i call processInput() inside the onclick event, there is another solution
> for this? i don´t want to call processInput() for all components inside the
> form.
>
> my code:
>
> public ClientStep(IDynamicWizardStep step,String label)
> {
> super(step);
> ....
> IModel<Client> model= new Model<Client>(client);
>
> setSummaryModel(new StringResourceModel("client.summary", this,
> model));
> .
>
> final TextField<String> field= new
> TextField<String>("client.field",new PropertyModel<String>(client, "field"){
> @Override
> public String getObject() {
> return client.getField();
> }
> @Override
> public void setObject(String object) {
> client.setField(object);
> }
No need to override setObject/getObject. PropertyModel does this for you.
> });
> clientContainer.add(nif);
>
>
> AjaxButton fieldSearch=new AjaxButton("fieldSearch"){
> @Override
> protected void onSubmit(AjaxRequestTarget art,
> Form<?> form) {
> // field.processInput();
> Client=...
>
> art.add(clientContainer);
> }
> @Override
> protected void onError(AjaxRequestTarget art,
> Form<?> form) {
> }
> };
>
> fieldSearch.setDefaultFormProcessing(false);
The problem is in the above line. It says "just call button's
#onSubmit() without actually doing the submit.
> clientContainer.add(fieldSearch);
> .................................................................
>
> public NewContract(String id)
> {
> super(id);
>
> setDefaultModel(new CompoundPropertyModel<NewContract>(this));
> DynamicWizardModel model = new DynamicWizardModel(new
> ClientStep(null,"client"));
> // initialize the wizard with the wizard model we just built
> init(model);
> }
> ************************************************
> thanks
>
> Frederico Rodrigues
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Re: dynamic wizard - update model
Posted by Frederico Rodrigues <fr...@ano.pt>.
Hi,
If i remove override setObject/getObject doesn´t work, this works when i
remove setDefaultFormProcessing
Em 10-04-2012 08:30, Martin Grigorov escreveu:
> Hi,
>
> On Mon, Apr 9, 2012 at 6:50 PM, Frederico Rodrigues
> <fr...@ano.pt> wrote:
>> Hello
>>
>> I have implement wicket wizard, but i have a small problem, i have an
>> ajaxbutton and i want update the model, but only have success with this when
>> i call processInput() inside the onclick event, there is another solution
>> for this? i don´t want to call processInput() for all components inside the
>> form.
>>
>> my code:
>>
>> public ClientStep(IDynamicWizardStep step,String label)
>> {
>> super(step);
>> ....
>> IModel<Client> model= new Model<Client>(client);
>>
>> setSummaryModel(new StringResourceModel("client.summary", this,
>> model));
>> .
>>
>> final TextField<String> field= new
>> TextField<String>("client.field",new PropertyModel<String>(client, "field"){
>> @Override
>> public String getObject() {
>> return client.getField();
>> }
>> @Override
>> public void setObject(String object) {
>> client.setField(object);
>> }
> No need to override setObject/getObject. PropertyModel does this for you.
>
>> });
>> clientContainer.add(nif);
>>
>>
>> AjaxButton fieldSearch=new AjaxButton("fieldSearch"){
>> @Override
>> protected void onSubmit(AjaxRequestTarget art,
>> Form<?> form) {
>> // field.processInput();
>> Client=...
>>
>> art.add(clientContainer);
>> }
>> @Override
>> protected void onError(AjaxRequestTarget art,
>> Form<?> form) {
>> }
>> };
>>
>> fieldSearch.setDefaultFormProcessing(false);
> The problem is in the above line. It says "just call button's
> #onSubmit() without actually doing the submit.
>
>> clientContainer.add(fieldSearch);
>> .................................................................
>>
>> public NewContract(String id)
>> {
>> super(id);
>>
>> setDefaultModel(new CompoundPropertyModel<NewContract>(this));
>> DynamicWizardModel model = new DynamicWizardModel(new
>> ClientStep(null,"client"));
>> // initialize the wizard with the wizard model we just built
>> init(model);
>> }
>> ************************************************
>> thanks
>>
>> Frederico Rodrigues
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
--
Com os melhores cumprimentos,
Frederico Rodrigues | Programador
ano - Sistemas de Informática e Serviços, Lda
Travessa Alferes Malheiro, 105 4000-060 PORTO, Portugal
Tel.: (+351) 222 061 580 e-mail:frederico_rodrigues@ano.pt
<ma...@ano.pt> sites: www.ano.pt
<http://www.ano.pt> | www.anogov.com <http://www.anogov.com>