You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Chang <da...@yahoo.com> on 2010/03/18 14:26:34 UTC

Select the "Choose one" of a required DropDownChoice

Hi, I am new in Wicket and am playing with different components. 

I have a two dropdown lists. One is a list of countries, required field, controlling another list of states/provinces via AjaxFormComponentUpdatingBehavior. 

The country list always has a blank (equivalent of "Choose one") as the first option in the list. When I select different countries, the state/province list changes accordingly. However, when I change to the blank in the country list, the state list stops updating. I looked into it and found out that in this situation (required droopdown list) selecting blank makes Wicket issue a feedback message instead of calling AjaxFormComponentUpdatingBehavior#onUpdate, which is what I want.

What can I do to make Wicket the way I want?

Thanks!






      

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


Re: Select the "Choose one" of a required DropDownChoice

Posted by James Carman <ja...@carmanconsulting.com>.
Perhaps put logic in onsubmit to check for required country?

On Mar 18, 2010 6:45 PM, "David Chang" <da...@yahoo.com> wrote:

Martin, the following is the code for the country dropdown list, which can
control the state dropdown list. The problem is that when the country list's
value is switched to "null" from a selected country (say, USA), then the
state dropdown list does not update. In addition, Wicket in the backend has
the following message. Another puzzling thing to me is that my FeedbackPanel
is there as defined below.

------- message --------

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



------- dropdown list code -------

List<Country> countryList = objectService.findAllCountries();
DropDownChoice countryDDC = new DropDownChoice("country",
               countryList,
               new ChoiceRenderer("name", "id") );
countryDDC.setRequired(true);
countryDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") {

       protected void onUpdate(AjaxRequestTarget target) {
               if (target != null) {
               MyUser u = f.getModelObject();
               u.setState(null);
               DropDownChoice stateDDC = (DropDownChoice) f.get("state");

 stateDDC.setChoices(objectService.findStatesByCountry(f.getModelObject().getCountry()));
             target.addComponent(stateDDC);
               }
       }
   });
f.add(new FormComponentFeedbackBorder("borderCountry").add(countryDDC));

------ FeedbackPanel code --------

add(new FeedbackPanel("feedbackHolder") {
       @Override
       public boolean isVisible() {
               return true;//anyMessage();
       }
}.setOutputMarkupId(true));








--- On Thu, 3/18/10, Martin Makundi <ma...@koodaripalvelut.com>
wrote:





> From: ...
> Date: Thursday, March 18, 2010, 11:50 AM

> Code?
>
> 2010/3/18 David Chang <da...@yahoo.com>:
> > Martin, thanks for chimining in. I...

Re: Select the "Choose one" of a required DropDownChoice

Posted by David Chang <da...@yahoo.com>.
Martin, the following is the code for the country dropdown list, which can control the state dropdown list. The problem is that when the country list's value is switched to "null" from a selected country (say, USA), then the state dropdown list does not update. In addition, Wicket in the backend has the following message. Another puzzling thing to me is that my FeedbackPanel is there as defined below.

------- message --------

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



------- dropdown list code -------

List<Country> countryList = objectService.findAllCountries();
DropDownChoice countryDDC = new DropDownChoice("country",
		countryList,
		new ChoiceRenderer("name", "id") );
countryDDC.setRequired(true);
countryDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") {

        protected void onUpdate(AjaxRequestTarget target) {
        	if (target != null) {
          	MyUser u = f.getModelObject();
          	u.setState(null);
          	DropDownChoice stateDDC = (DropDownChoice) f.get("state");
          	stateDDC.setChoices(objectService.findStatesByCountry(f.getModelObject().getCountry()));
              target.addComponent(stateDDC);
        	}
        }
    });
f.add(new FormComponentFeedbackBorder("borderCountry").add(countryDDC));

------ FeedbackPanel code --------

add(new FeedbackPanel("feedbackHolder") {
	@Override
	public boolean isVisible() {
		return true;//anyMessage();
	}
}.setOutputMarkupId(true));







--- On Thu, 3/18/10, Martin Makundi <ma...@koodaripalvelut.com> wrote:





> From: Martin Makundi <ma...@koodaripalvelut.com>
> Subject: Re: Select the "Choose one" of a required DropDownChoice
> To: users@wicket.apache.org
> Date: Thursday, March 18, 2010, 11:50 AM
> Code?
> 
> 2010/3/18 David Chang <da...@yahoo.com>:
> > Martin, thanks for chimining in. I already did that.
> The problem is when I select "null" (choose one),
> AjaxFormComponentUpdatingBehavior#onUpdate is not called.
> Instead, Wicket generates a message and tries to seed it
> FeedbackPanel. I want to be able to handle that "null" and
> set another dropdown list blank.
> >
> > Regards.
> >
> > --- On Thu, 3/18/10, Martin Makundi <ma...@koodaripalvelut.com>
> wrote:
> >
> >> From: Martin Makundi <ma...@koodaripalvelut.com>
> >> Subject: Re: Select the "Choose one" of a required
> DropDownChoice
> >> To: users@wicket.apache.org
> >> Date: Thursday, March 18, 2010, 10:58 AM
> >> setNullValid
> >>
> >> 2010/3/18 David Chang <da...@yahoo.com>:
> >> > In my case, the field is required. I make it
> required
> >> by setRequired(true), but I want the blank/choose
> one is
> >> still there.
> >> >
> >> > Doable?
> >> >
> >> >
> >> > --- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch>
> >> wrote:
> >> >
> >> >> From: Matthias Keller <ma...@ergon.ch>
> >> >> Subject: Re: Select the "Choose one" of a
> required
> >> DropDownChoice
> >> >> To: users@wicket.apache.org
> >> >> Date: Thursday, March 18, 2010, 9:42 AM
> >> >> Hi
> >> >>
> >> >> Yes, exactly, but why do you have it set
> to
> >> required at all
> >> >> in first
> >> >> place if you want to allow the empty
> selection
> >> too?
> >> >> I dont think a DropDownChoice is required
> by
> >> default but if
> >> >> it is, try
> >> >> setRequired(false) ...
> >> >>
> >> >> Matt
> >> >>
> >> >> On 2010-03-18 14:36, David Chang wrote:
> >> >> > Matt, I already did that.
> >> >> >
> >> >> > DropDownChoice.setNullValid() makes
> "Choose
> >> one"
> >> >> always stay there.
> >> >> > I notice that
> DropDownChoice.setRequired() is
> >> the
> >> >> reason to generate the message and not
> get
> >> onUpdate called.
> >> >> >
> >> >> > Thanks.
> >> >> >
> >> >> >
> >> >> > --- On Thu, 3/18/10, Matthias
> Keller<ma...@ergon.ch>
> >> >> wrote:
> >> >> >
> >> >> >
> >> >> >> From: Matthias Keller<ma...@ergon.ch>
> >> >> >> Subject: Re: Select the "Choose
> one" of a
> >> required
> >> >> DropDownChoice
> >> >> >> To: users@wicket.apache.org
> >> >> >> Date: Thursday, March 18, 2010,
> 9:30 AM
> >> >> >> Hi
> >> >> >>
> >> >> >> Have a look at
> >> DropDownChoice.setNullValid() and
> >> >> >> .setRequired()
> >> >> >>
> >> >> >> Matt
> >> >> >>
> >> >> >> On 2010-03-18 14:26, David Chang
> wrote:
> >> >> >>
> >> >> >>> Hi, I am new in Wicket and
> am playing
> >> with
> >> >> different
> >> >> >>>
> >> >> >> components.
> >> >> >>
> >> >> >>> I have a two dropdown lists.
> One is a
> >> list of
> >> >> >>>
> >> >> >> countries, required field,
> controlling
> >> another
> >> >> list of
> >> >> >> states/provinces via
> >> >> AjaxFormComponentUpdatingBehavior.
> >> >> >>
> >> >> >>> The country list always has
> a blank
> >> >> (equivalent of
> >> >> >>>
> >> >> >> "Choose one") as the first
> option in the
> >> list.
> >> >> When I select
> >> >> >> different countries, the
> state/province
> >> list
> >> >> changes
> >> >> >> accordingly. However, when I
> change to
> >> the blank
> >> >> in the
> >> >> >> country list, the state list
> stops
> >> updating. I
> >> >> looked into
> >> >> >> it and found out that in this
> situation
> >> (required
> >> >> droopdown
> >> >> >> list) selecting blank makes
> Wicket issue
> >> a
> >> >> feedback message
> >> >> >> instead of calling
> >> >> >>
> >> AjaxFormComponentUpdatingBehavior#onUpdate, which
> >> >> is what I
> >> >> >> want.
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> ---------------------------------------------------------------------
> >> > 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
> >>
> >>
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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
> 
> 


      

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


Re: Select the "Choose one" of a required DropDownChoice

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Code?

2010/3/18 David Chang <da...@yahoo.com>:
> Martin, thanks for chimining in. I already did that. The problem is when I select "null" (choose one), AjaxFormComponentUpdatingBehavior#onUpdate is not called. Instead, Wicket generates a message and tries to seed it FeedbackPanel. I want to be able to handle that "null" and set another dropdown list blank.
>
> Regards.
>
> --- On Thu, 3/18/10, Martin Makundi <ma...@koodaripalvelut.com> wrote:
>
>> From: Martin Makundi <ma...@koodaripalvelut.com>
>> Subject: Re: Select the "Choose one" of a required DropDownChoice
>> To: users@wicket.apache.org
>> Date: Thursday, March 18, 2010, 10:58 AM
>> setNullValid
>>
>> 2010/3/18 David Chang <da...@yahoo.com>:
>> > In my case, the field is required. I make it required
>> by setRequired(true), but I want the blank/choose one is
>> still there.
>> >
>> > Doable?
>> >
>> >
>> > --- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch>
>> wrote:
>> >
>> >> From: Matthias Keller <ma...@ergon.ch>
>> >> Subject: Re: Select the "Choose one" of a required
>> DropDownChoice
>> >> To: users@wicket.apache.org
>> >> Date: Thursday, March 18, 2010, 9:42 AM
>> >> Hi
>> >>
>> >> Yes, exactly, but why do you have it set to
>> required at all
>> >> in first
>> >> place if you want to allow the empty selection
>> too?
>> >> I dont think a DropDownChoice is required by
>> default but if
>> >> it is, try
>> >> setRequired(false) ...
>> >>
>> >> Matt
>> >>
>> >> On 2010-03-18 14:36, David Chang wrote:
>> >> > Matt, I already did that.
>> >> >
>> >> > DropDownChoice.setNullValid() makes "Choose
>> one"
>> >> always stay there.
>> >> > I notice that DropDownChoice.setRequired() is
>> the
>> >> reason to generate the message and not get
>> onUpdate called.
>> >> >
>> >> > Thanks.
>> >> >
>> >> >
>> >> > --- On Thu, 3/18/10, Matthias Keller<ma...@ergon.ch>
>> >> wrote:
>> >> >
>> >> >
>> >> >> From: Matthias Keller<ma...@ergon.ch>
>> >> >> Subject: Re: Select the "Choose one" of a
>> required
>> >> DropDownChoice
>> >> >> To: users@wicket.apache.org
>> >> >> Date: Thursday, March 18, 2010, 9:30 AM
>> >> >> Hi
>> >> >>
>> >> >> Have a look at
>> DropDownChoice.setNullValid() and
>> >> >> .setRequired()
>> >> >>
>> >> >> Matt
>> >> >>
>> >> >> On 2010-03-18 14:26, David Chang wrote:
>> >> >>
>> >> >>> Hi, I am new in Wicket and am playing
>> with
>> >> different
>> >> >>>
>> >> >> components.
>> >> >>
>> >> >>> I have a two dropdown lists. One is a
>> list of
>> >> >>>
>> >> >> countries, required field, controlling
>> another
>> >> list of
>> >> >> states/provinces via
>> >> AjaxFormComponentUpdatingBehavior.
>> >> >>
>> >> >>> The country list always has a blank
>> >> (equivalent of
>> >> >>>
>> >> >> "Choose one") as the first option in the
>> list.
>> >> When I select
>> >> >> different countries, the state/province
>> list
>> >> changes
>> >> >> accordingly. However, when I change to
>> the blank
>> >> in the
>> >> >> country list, the state list stops
>> updating. I
>> >> looked into
>> >> >> it and found out that in this situation
>> (required
>> >> droopdown
>> >> >> list) selecting blank makes Wicket issue
>> a
>> >> feedback message
>> >> >> instead of calling
>> >> >>
>> AjaxFormComponentUpdatingBehavior#onUpdate, which
>> >> is what I
>> >> >> want.
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > 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
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Select the "Choose one" of a required DropDownChoice

Posted by David Chang <da...@yahoo.com>.
Martin, thanks for chimining in. I already did that. The problem is when I select "null" (choose one), AjaxFormComponentUpdatingBehavior#onUpdate is not called. Instead, Wicket generates a message and tries to seed it FeedbackPanel. I want to be able to handle that "null" and set another dropdown list blank.

Regards.

--- On Thu, 3/18/10, Martin Makundi <ma...@koodaripalvelut.com> wrote:

> From: Martin Makundi <ma...@koodaripalvelut.com>
> Subject: Re: Select the "Choose one" of a required DropDownChoice
> To: users@wicket.apache.org
> Date: Thursday, March 18, 2010, 10:58 AM
> setNullValid
> 
> 2010/3/18 David Chang <da...@yahoo.com>:
> > In my case, the field is required. I make it required
> by setRequired(true), but I want the blank/choose one is
> still there.
> >
> > Doable?
> >
> >
> > --- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch>
> wrote:
> >
> >> From: Matthias Keller <ma...@ergon.ch>
> >> Subject: Re: Select the "Choose one" of a required
> DropDownChoice
> >> To: users@wicket.apache.org
> >> Date: Thursday, March 18, 2010, 9:42 AM
> >> Hi
> >>
> >> Yes, exactly, but why do you have it set to
> required at all
> >> in first
> >> place if you want to allow the empty selection
> too?
> >> I dont think a DropDownChoice is required by
> default but if
> >> it is, try
> >> setRequired(false) ...
> >>
> >> Matt
> >>
> >> On 2010-03-18 14:36, David Chang wrote:
> >> > Matt, I already did that.
> >> >
> >> > DropDownChoice.setNullValid() makes "Choose
> one"
> >> always stay there.
> >> > I notice that DropDownChoice.setRequired() is
> the
> >> reason to generate the message and not get
> onUpdate called.
> >> >
> >> > Thanks.
> >> >
> >> >
> >> > --- On Thu, 3/18/10, Matthias Keller<ma...@ergon.ch>
> >> wrote:
> >> >
> >> >
> >> >> From: Matthias Keller<ma...@ergon.ch>
> >> >> Subject: Re: Select the "Choose one" of a
> required
> >> DropDownChoice
> >> >> To: users@wicket.apache.org
> >> >> Date: Thursday, March 18, 2010, 9:30 AM
> >> >> Hi
> >> >>
> >> >> Have a look at
> DropDownChoice.setNullValid() and
> >> >> .setRequired()
> >> >>
> >> >> Matt
> >> >>
> >> >> On 2010-03-18 14:26, David Chang wrote:
> >> >>
> >> >>> Hi, I am new in Wicket and am playing
> with
> >> different
> >> >>>
> >> >> components.
> >> >>
> >> >>> I have a two dropdown lists. One is a
> list of
> >> >>>
> >> >> countries, required field, controlling
> another
> >> list of
> >> >> states/provinces via
> >> AjaxFormComponentUpdatingBehavior.
> >> >>
> >> >>> The country list always has a blank
> >> (equivalent of
> >> >>>
> >> >> "Choose one") as the first option in the
> list.
> >> When I select
> >> >> different countries, the state/province
> list
> >> changes
> >> >> accordingly. However, when I change to
> the blank
> >> in the
> >> >> country list, the state list stops
> updating. I
> >> looked into
> >> >> it and found out that in this situation
> (required
> >> droopdown
> >> >> list) selecting blank makes Wicket issue
> a
> >> feedback message
> >> >> instead of calling
> >> >>
> AjaxFormComponentUpdatingBehavior#onUpdate, which
> >> is what I
> >> >> want.
> >> >>
> >> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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
> 
> 


      

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


Re: Select the "Choose one" of a required DropDownChoice

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
setNullValid

2010/3/18 David Chang <da...@yahoo.com>:
> In my case, the field is required. I make it required by setRequired(true), but I want the blank/choose one is still there.
>
> Doable?
>
>
> --- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch> wrote:
>
>> From: Matthias Keller <ma...@ergon.ch>
>> Subject: Re: Select the "Choose one" of a required DropDownChoice
>> To: users@wicket.apache.org
>> Date: Thursday, March 18, 2010, 9:42 AM
>> Hi
>>
>> Yes, exactly, but why do you have it set to required at all
>> in first
>> place if you want to allow the empty selection too?
>> I dont think a DropDownChoice is required by default but if
>> it is, try
>> setRequired(false) ...
>>
>> Matt
>>
>> On 2010-03-18 14:36, David Chang wrote:
>> > Matt, I already did that.
>> >
>> > DropDownChoice.setNullValid() makes "Choose one"
>> always stay there.
>> > I notice that DropDownChoice.setRequired() is the
>> reason to generate the message and not get onUpdate called.
>> >
>> > Thanks.
>> >
>> >
>> > --- On Thu, 3/18/10, Matthias Keller<ma...@ergon.ch>
>> wrote:
>> >
>> >
>> >> From: Matthias Keller<ma...@ergon.ch>
>> >> Subject: Re: Select the "Choose one" of a required
>> DropDownChoice
>> >> To: users@wicket.apache.org
>> >> Date: Thursday, March 18, 2010, 9:30 AM
>> >> Hi
>> >>
>> >> Have a look at DropDownChoice.setNullValid() and
>> >> .setRequired()
>> >>
>> >> Matt
>> >>
>> >> On 2010-03-18 14:26, David Chang wrote:
>> >>
>> >>> Hi, I am new in Wicket and am playing with
>> different
>> >>>
>> >> components.
>> >>
>> >>> I have a two dropdown lists. One is a list of
>> >>>
>> >> countries, required field, controlling another
>> list of
>> >> states/provinces via
>> AjaxFormComponentUpdatingBehavior.
>> >>
>> >>> The country list always has a blank
>> (equivalent of
>> >>>
>> >> "Choose one") as the first option in the list.
>> When I select
>> >> different countries, the state/province list
>> changes
>> >> accordingly. However, when I change to the blank
>> in the
>> >> country list, the state list stops updating. I
>> looked into
>> >> it and found out that in this situation (required
>> droopdown
>> >> list) selecting blank makes Wicket issue a
>> feedback message
>> >> instead of calling
>> >> AjaxFormComponentUpdatingBehavior#onUpdate, which
>> is what I
>> >> want.
>> >>
>> >>
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Select the "Choose one" of a required DropDownChoice

Posted by David Chang <da...@yahoo.com>.
In my case, the field is required. I make it required by setRequired(true), but I want the blank/choose one is still there. 

Doable?


--- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch> wrote:

> From: Matthias Keller <ma...@ergon.ch>
> Subject: Re: Select the "Choose one" of a required DropDownChoice
> To: users@wicket.apache.org
> Date: Thursday, March 18, 2010, 9:42 AM
> Hi
> 
> Yes, exactly, but why do you have it set to required at all
> in first 
> place if you want to allow the empty selection too?
> I dont think a DropDownChoice is required by default but if
> it is, try  
> setRequired(false) ...
> 
> Matt
> 
> On 2010-03-18 14:36, David Chang wrote:
> > Matt, I already did that.
> >
> > DropDownChoice.setNullValid() makes "Choose one"
> always stay there.
> > I notice that DropDownChoice.setRequired() is the
> reason to generate the message and not get onUpdate called.
> >
> > Thanks.
> >
> >
> > --- On Thu, 3/18/10, Matthias Keller<ma...@ergon.ch> 
> wrote:
> >
> >    
> >> From: Matthias Keller<ma...@ergon.ch>
> >> Subject: Re: Select the "Choose one" of a required
> DropDownChoice
> >> To: users@wicket.apache.org
> >> Date: Thursday, March 18, 2010, 9:30 AM
> >> Hi
> >>
> >> Have a look at DropDownChoice.setNullValid() and
> >> .setRequired()
> >>
> >> Matt
> >>
> >> On 2010-03-18 14:26, David Chang wrote:
> >>      
> >>> Hi, I am new in Wicket and am playing with
> different
> >>>        
> >> components.
> >>      
> >>> I have a two dropdown lists. One is a list of
> >>>        
> >> countries, required field, controlling another
> list of
> >> states/provinces via
> AjaxFormComponentUpdatingBehavior.
> >>      
> >>> The country list always has a blank
> (equivalent of
> >>>        
> >> "Choose one") as the first option in the list.
> When I select
> >> different countries, the state/province list
> changes
> >> accordingly. However, when I change to the blank
> in the
> >> country list, the state list stops updating. I
> looked into
> >> it and found out that in this situation (required
> droopdown
> >> list) selecting blank makes Wicket issue a
> feedback message
> >> instead of calling
> >> AjaxFormComponentUpdatingBehavior#onUpdate, which
> is what I
> >> want.
> >>      
> >>
> 
> 
> 


      

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


Re: Select the "Choose one" of a required DropDownChoice

Posted by Matthias Keller <ma...@ergon.ch>.
Hi

Yes, exactly, but why do you have it set to required at all in first 
place if you want to allow the empty selection too?
I dont think a DropDownChoice is required by default but if it is, try  
setRequired(false) ...

Matt

On 2010-03-18 14:36, David Chang wrote:
> Matt, I already did that.
>
> DropDownChoice.setNullValid() makes "Choose one" always stay there.
> I notice that DropDownChoice.setRequired() is the reason to generate the message and not get onUpdate called.
>
> Thanks.
>
>
> --- On Thu, 3/18/10, Matthias Keller<ma...@ergon.ch>  wrote:
>
>    
>> From: Matthias Keller<ma...@ergon.ch>
>> Subject: Re: Select the "Choose one" of a required DropDownChoice
>> To: users@wicket.apache.org
>> Date: Thursday, March 18, 2010, 9:30 AM
>> Hi
>>
>> Have a look at DropDownChoice.setNullValid() and
>> .setRequired()
>>
>> Matt
>>
>> On 2010-03-18 14:26, David Chang wrote:
>>      
>>> Hi, I am new in Wicket and am playing with different
>>>        
>> components.
>>      
>>> I have a two dropdown lists. One is a list of
>>>        
>> countries, required field, controlling another list of
>> states/provinces via AjaxFormComponentUpdatingBehavior.
>>      
>>> The country list always has a blank (equivalent of
>>>        
>> "Choose one") as the first option in the list. When I select
>> different countries, the state/province list changes
>> accordingly. However, when I change to the blank in the
>> country list, the state list stops updating. I looked into
>> it and found out that in this situation (required droopdown
>> list) selecting blank makes Wicket issue a feedback message
>> instead of calling
>> AjaxFormComponentUpdatingBehavior#onUpdate, which is what I
>> want.
>>      
>>



Re: Select the "Choose one" of a required DropDownChoice

Posted by David Chang <da...@yahoo.com>.
Matt, I already did that.

DropDownChoice.setNullValid() makes "Choose one" always stay there.
I notice that DropDownChoice.setRequired() is the reason to generate the message and not get onUpdate called.

Thanks.


--- On Thu, 3/18/10, Matthias Keller <ma...@ergon.ch> wrote:

> From: Matthias Keller <ma...@ergon.ch>
> Subject: Re: Select the "Choose one" of a required DropDownChoice
> To: users@wicket.apache.org
> Date: Thursday, March 18, 2010, 9:30 AM
> Hi
> 
> Have a look at DropDownChoice.setNullValid() and
> .setRequired()
> 
> Matt
> 
> On 2010-03-18 14:26, David Chang wrote:
> > Hi, I am new in Wicket and am playing with different
> components.
> >
> > I have a two dropdown lists. One is a list of
> countries, required field, controlling another list of
> states/provinces via AjaxFormComponentUpdatingBehavior.
> >
> > The country list always has a blank (equivalent of
> "Choose one") as the first option in the list. When I select
> different countries, the state/province list changes
> accordingly. However, when I change to the blank in the
> country list, the state list stops updating. I looked into
> it and found out that in this situation (required droopdown
> list) selecting blank makes Wicket issue a feedback message
> instead of calling
> AjaxFormComponentUpdatingBehavior#onUpdate, which is what I
> want.
> >
> > What can I do to make Wicket the way I want?
> >
> > Thanks!
> 
> 
> 


      

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


Re: Select the "Choose one" of a required DropDownChoice

Posted by Matthias Keller <ma...@ergon.ch>.
Hi

Have a look at DropDownChoice.setNullValid() and .setRequired()

Matt

On 2010-03-18 14:26, David Chang wrote:
> Hi, I am new in Wicket and am playing with different components.
>
> I have a two dropdown lists. One is a list of countries, required field, controlling another list of states/provinces via AjaxFormComponentUpdatingBehavior.
>
> The country list always has a blank (equivalent of "Choose one") as the first option in the list. When I select different countries, the state/province list changes accordingly. However, when I change to the blank in the country list, the state list stops updating. I looked into it and found out that in this situation (required droopdown list) selecting blank makes Wicket issue a feedback message instead of calling AjaxFormComponentUpdatingBehavior#onUpdate, which is what I want.
>
> What can I do to make Wicket the way I want?
>
> Thanks!