You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maximiliano Gomez Vidal <mv...@gmail.com> on 2009/12/10 14:31:27 UTC

DateField default id

I'm using DateField with the beautiful YUI DatePicker in a form with a
ComponentFeedbackPanel associated to each field. To my surprise, the
date validation errors are not being shown in the corresponding panel.
By browsing the classes I came across:

@Override
protected void onBeforeRender()
{
    if (dateField == null)
    {
        // intiailize datefield and datepicker
        PropertyModel<Date> dateFieldModel = new
PropertyModel<Date>(this, "date");
       add(dateField = newDateTextField("date", dateFieldModel));
       dateField.add(newDatePicker());
    }
...

What about those hardcoded "date" IDs?

I'm adding the DateField like this:

add(new DateField(FORM_FIELD_BIRTHDAY, new PropertyModel<Date>(
					aPerson, FORM_FIELD_BIRTHDAY)).add(
					DateValidator.maximum(new Date())).setRequired(true));

and the ComponentFeedbackPanel:

add(new ComponentFeedbackPanel(fc.getId() + FORM_FEEDBACK, fc)
					.setOutputMarkupId(true));

I've added a DateValidator.maximum(new Date())) and this message is shown OK.

The error jetty complains about is:

WARN  - WebSession                 - Component-targetted feedback
message was left unrendered. This could be because you are missing a
FeedbackPanel on the page.  Message: [FeedbackMessage message = "Field
'date' is required.", reporter = date, level = ERROR]

Thanks in advance,
Maxi

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


Re: DateField default id

Posted by Igor Vaynberg <ig...@gmail.com>.
you may need to wrtie your own ComponentFeedbackPanel that also allows
messages from any descendants of the component it is given.

-igor

On Thu, Dec 10, 2009 at 5:31 AM, Maximiliano Gomez Vidal
<mv...@gmail.com> wrote:
> I'm using DateField with the beautiful YUI DatePicker in a form with a
> ComponentFeedbackPanel associated to each field. To my surprise, the
> date validation errors are not being shown in the corresponding panel.
> By browsing the classes I came across:
>
> @Override
> protected void onBeforeRender()
> {
>    if (dateField == null)
>    {
>        // intiailize datefield and datepicker
>        PropertyModel<Date> dateFieldModel = new
> PropertyModel<Date>(this, "date");
>       add(dateField = newDateTextField("date", dateFieldModel));
>       dateField.add(newDatePicker());
>    }
> ...
>
> What about those hardcoded "date" IDs?
>
> I'm adding the DateField like this:
>
> add(new DateField(FORM_FIELD_BIRTHDAY, new PropertyModel<Date>(
>                                        aPerson, FORM_FIELD_BIRTHDAY)).add(
>                                        DateValidator.maximum(new Date())).setRequired(true));
>
> and the ComponentFeedbackPanel:
>
> add(new ComponentFeedbackPanel(fc.getId() + FORM_FEEDBACK, fc)
>                                        .setOutputMarkupId(true));
>
> I've added a DateValidator.maximum(new Date())) and this message is shown OK.
>
> The error jetty complains about is:
>
> WARN  - WebSession                 - Component-targetted feedback
> message was left unrendered. This could be because you are missing a
> FeedbackPanel on the page.  Message: [FeedbackMessage message = "Field
> 'date' is required.", reporter = date, level = ERROR]
>
> Thanks in advance,
> Maxi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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