You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mattijs Hoitink <ma...@func.nl> on 2007/10/11 15:09:58 UTC

Model update with Link

hi,

i'm just starting to use wicket and i have a question regarding updating 
a model when a link is pressed. I will explain my situation.

I have a normal form, with a model attached to it and a button to submit 
it. There is also a link in the form who's only purpose is to enable or 
disable a field.
The problem is, when i  press the link to disable the field, all my data 
from the other fields is lost. It seems like wicket is loading a new 
form when i presse the link, because all the old data from the model is 
presented.

My question is: is it normal wicket loads the page again when a link is 
pressed? and if so, is there a way to update my model first?

--
Mattijs Hoitink
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Model update with Link

Posted by Igor Vaynberg <ig...@gmail.com>.
setdefaultformprocessing(false)

-igor


On 10/11/07, Mattijs Hoitink <ma...@func.nl> wrote:
>
> I already tried using a SubmitLink. The problem with that is user have
> to complete the whole form (or at least the required fields) before they
> can disable the field with the link. This is because validate() is
> called when the form is submitted, and users receive a message they have
> to fill in the required fields.I want users to be able to disable the
> field even though they did not fill in all the (required) fields.
>
> Secondly, when the form is submitted, the model is send to the database.
> I only want to send the model to the database when the user is
> completely finished with the form, and not when they want to disabled
> the second field of the form. But this can be solved by calling
> findSubmittingButton() in the onSubmit().
>
>
> martinf wrote:
> > Maybe SubmitLink is your solution,
> >
> > usage as an anonymous class could look like this:
> >
> >               add(new SubmitLink("lkjsdf", form) {
> >                       public void onSubmit() {
> >                                //Do what you need to do here.
> >                       }
> >               });
> >
> > that way the browser will submit the form and send al the date in the
> input
> > fields.
> >
> >
> > Martin
> >
> >
> > Mattijs Hoitink wrote:
> >
> >> hi,
> >>
> >> i'm just starting to use wicket and i have a question regarding
> updating
> >> a model when a link is pressed. I will explain my situation.
> >>
> >> I have a normal form, with a model attached to it and a button to
> submit
> >> it. There is also a link in the form who's only purpose is to enable or
> >> disable a field.
> >> The problem is, when i  press the link to disable the field, all my
> data
> >> from the other fields is lost. It seems like wicket is loading a new
> >> form when i presse the link, because all the old data from the model is
> >> presented.
> >>
> >> My question is: is it normal wicket loads the page again when a link is
> >> pressed? and if so, is there a way to update my model first?
> >>
> >> --
> >> Mattijs Hoitink
> >> Func. Internet Integration
> >> W http://www.func.nl
> >> T +31 20 4230000
> >> F +31 20 4223500
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >>
> >>
> >
> >
>
> --
> Mattijs Hoitink
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Model update with Link

Posted by Mattijs Hoitink <ma...@func.nl>.
I already tried using a SubmitLink. The problem with that is user have 
to complete the whole form (or at least the required fields) before they 
can disable the field with the link. This is because validate() is 
called when the form is submitted, and users receive a message they have 
to fill in the required fields.I want users to be able to disable the 
field even though they did not fill in all the (required) fields.

Secondly, when the form is submitted, the model is send to the database. 
I only want to send the model to the database when the user is 
completely finished with the form, and not when they want to disabled 
the second field of the form. But this can be solved by calling 
findSubmittingButton() in the onSubmit().


martinf wrote:
> Maybe SubmitLink is your solution,
>
> usage as an anonymous class could look like this:
>
> 		add(new SubmitLink("lkjsdf", form) {
> 			public void onSubmit() {
>                                //Do what you need to do here.
> 			}
> 		});
>
> that way the browser will submit the form and send al the date in the input
> fields.
>
>
> Martin
>
>
> Mattijs Hoitink wrote:
>   
>> hi,
>>
>> i'm just starting to use wicket and i have a question regarding updating
>> a model when a link is pressed. I will explain my situation.
>>
>> I have a normal form, with a model attached to it and a button to submit
>> it. There is also a link in the form who's only purpose is to enable or
>> disable a field.
>> The problem is, when i  press the link to disable the field, all my data
>> from the other fields is lost. It seems like wicket is loading a new
>> form when i presse the link, because all the old data from the model is
>> presented.
>>
>> My question is: is it normal wicket loads the page again when a link is
>> pressed? and if so, is there a way to update my model first?
>>
>> --
>> Mattijs Hoitink
>> Func. Internet Integration
>> W http://www.func.nl
>> T +31 20 4230000
>> F +31 20 4223500
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>   

--
Mattijs Hoitink
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Model update with Link

Posted by martinf <fu...@arcor.de>.
Maybe SubmitLink is your solution,

usage as an anonymous class could look like this:

		add(new SubmitLink("lkjsdf", form) {
			public void onSubmit() {
                               //Do what you need to do here.
			}
		});

that way the browser will submit the form and send al the date in the input
fields.


Martin


Mattijs Hoitink wrote:
> 
> hi,
> 
> i'm just starting to use wicket and i have a question regarding updating 
> a model when a link is pressed. I will explain my situation.
> 
> I have a normal form, with a model attached to it and a button to submit 
> it. There is also a link in the form who's only purpose is to enable or 
> disable a field.
> The problem is, when i  press the link to disable the field, all my data 
> from the other fields is lost. It seems like wicket is loading a new 
> form when i presse the link, because all the old data from the model is 
> presented.
> 
> My question is: is it normal wicket loads the page again when a link is 
> pressed? and if so, is there a way to update my model first?
> 
> --
> Mattijs Hoitink
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Model-update-with-Link-tf4607178.html#a13155954
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Model update with Link

Posted by Swaroop Belur <sw...@gmail.com>.
>> My question is: is it normal wicket loads the page again when a link is
pressed?

- Yes - It renders the page after finishing ur onclick

>> and if so, is there a way to update my model first?

Use submitlink  instead of Link if u want to show the new values

-swaroop



On 10/11/07, Mattijs Hoitink <ma...@func.nl> wrote:
>
> hi,
>
> i'm just starting to use wicket and i have a question regarding updating
> a model when a link is pressed. I will explain my situation.
>
> I have a normal form, with a model attached to it and a button to submit
> it. There is also a link in the form who's only purpose is to enable or
> disable a field.
> The problem is, when i  press the link to disable the field, all my data
> from the other fields is lost. It seems like wicket is loading a new
> form when i presse the link, because all the old data from the model is
> presented.
>
> My question is: is it normal wicket loads the page again when a link is
> pressed? and if so, is there a way to update my model first?
>
> --
> Mattijs Hoitink
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>