You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gervais <ge...@polymedis.com> on 2007/11/26 14:49:54 UTC
Form with CompounPropertyModel never call onSubmit()
Hi all,
I have this form component :
public class RegistrationForm extends Form {
private final static long serialVersionUID = 1l;
public RegistrationForm(String id, StudentFolder studentFolder) {
super(id, new CompoundPropertyModel(studentFolder));
add(new RequiredTextField("student.firstName"));
add(new RequiredTextField("student.lastName"));
add(new RequiredTextField("student.dateOfBirth"));
add(new RequiredTextField("student.placeOfBirth"));
/*super(id);
add(new RequiredTextField("student.firstName",new
Model("fname")));
add(new RequiredTextField("student.lastName",new
Model("lname")));
add(new RequiredTextField("student.dateOfBirth",new
Model("dob")));
add(new RequiredTextField("student.placeOfBirth",new
Model("pob")));*/
}
protected void onSubmit() {
for ( int i=0; i<20; i++)
System.out.println("");
System.out.println(">>>>> submit");
for ( int i=0; i<20; i++)
System.out.println("");
}
}
With the usage of CompounPropertyModel the content of onSubmit() never
run. But if i comment the usage of compoundPropertyModel and use Static
model it work.
Can you help me ?
Thanks
Re: Form with CompounPropertyModel never call onSubmit()
Posted by Martijn Dashorst <ma...@gmail.com>.
Add a feedback panel to your page and notice the validation errors.
Martijn
On Nov 26, 2007 2:49 PM, Gervais <ge...@polymedis.com> wrote:
> Hi all,
>
> I have this form component :
>
> public class RegistrationForm extends Form {
>
> private final static long serialVersionUID = 1l;
>
> public RegistrationForm(String id, StudentFolder studentFolder) {
> super(id, new CompoundPropertyModel(studentFolder));
> add(new RequiredTextField("student.firstName"));
> add(new RequiredTextField("student.lastName"));
> add(new RequiredTextField("student.dateOfBirth"));
> add(new RequiredTextField("student.placeOfBirth"));
>
> /*super(id);
> add(new RequiredTextField("student.firstName",new
> Model("fname")));
> add(new RequiredTextField("student.lastName",new
> Model("lname")));
> add(new RequiredTextField("student.dateOfBirth",new
> Model("dob")));
> add(new RequiredTextField("student.placeOfBirth",new
> Model("pob")));*/
> }
>
> protected void onSubmit() {
> for ( int i=0; i<20; i++)
> System.out.println("");
>
> System.out.println(">>>>> submit");
>
> for ( int i=0; i<20; i++)
> System.out.println("");
> }
> }
>
> With the usage of CompounPropertyModel the content of onSubmit() never
> run. But if i comment the usage of compoundPropertyModel and use Static
> model it work.
>
> Can you help me ?
>
> Thanks
>
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/
Re: How to validate a date in a defined format
Posted by Igor Vaynberg <ig...@gmail.com>.
see DateField in extensions and in wicket-datetime modules, they take
care of this...
-igor
On Nov 26, 2007 6:16 AM, Gervais <ge...@polymedis.com> wrote:
> Hi All
>
>
> In my form i have added a required text filed for hold a date. My model
> object have a setter..
>
> ------
> add(new RequiredTextField("dateOfBirth", java.util.Date.class));
> ------
> public void setDateOfBirth(Date date) {
> this.date = date;
> }
> public Date getDateOfBirth() {
> return date;
> }
> ------
> But i'm french and users enter date as YYYY/mm/dd or YYY-mm-dd how can
> i tel to wicket how to put the date to my Object ?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
How to validate a date in a defined format
Posted by Gervais <ge...@polymedis.com>.
Hi All
In my form i have added a required text filed for hold a date. My model
object have a setter..
------
add(new RequiredTextField("dateOfBirth", java.util.Date.class));
------
public void setDateOfBirth(Date date) {
this.date = date;
}
public Date getDateOfBirth() {
return date;
}
------
But i'm french and users enter date as YYYY/mm/dd or YYY-mm-dd how can
i tel to wicket how to put the date to my Object ?
Re: Form with CompounPropertyModel never call onSubmit()
Posted by Gervais <ge...@polymedis.com>.
Oups sorry, its just because when i try to submit dateOfBirth and
PlaceOfBirth that are RequiredTextFields was empty.
Sorry.
Gervais a écrit :
> Hi all,
>
> I have this form component :
>
> public class RegistrationForm extends Form {
> private final static long serialVersionUID = 1l;
>
> public RegistrationForm(String id, StudentFolder studentFolder) {
> super(id, new CompoundPropertyModel(studentFolder));
> add(new RequiredTextField("student.firstName"));
> add(new RequiredTextField("student.lastName"));
> add(new RequiredTextField("student.dateOfBirth"));
> add(new RequiredTextField("student.placeOfBirth"));
> /*super(id);
> add(new RequiredTextField("student.firstName",new
> Model("fname")));
> add(new RequiredTextField("student.lastName",new
> Model("lname")));
> add(new RequiredTextField("student.dateOfBirth",new
> Model("dob")));
> add(new RequiredTextField("student.placeOfBirth",new
> Model("pob")));*/
> }
>
> protected void onSubmit() {
> for ( int i=0; i<20; i++)
> System.out.println("");
> System.out.println(">>>>> submit");
> for ( int i=0; i<20; i++)
> System.out.println("");
> } }
>
> With the usage of CompounPropertyModel the content of onSubmit() never
> run. But if i comment the usage of compoundPropertyModel and use
> Static model it work.
>
> Can you help me ?
>
> Thanks
>
>
>
>
>
> __________ NOD32 2686 (20071126) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>