Re: Choose One problem with DropDownChoice

2011-04-15 Thread Mike Mander

Am 15.04.2011 15:55, schrieb tech7:

Any suggestion?

-
Wicket-Java
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choose-One-problem-with-DropDownChoice-tp3451837p3452096.html
Sent from the Users forum mailing list archive at Nabble.com.

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



new DropDownChoice("myId", Model.of(selected), ListModel.of(choices));
If you remove the item from choices the ddc can't set anything selected 
anymore. So it displays "Choose one".
If you want to display another item, set it to model representing 
selected item in ddc.


Cheers
Mike


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



Re: Choose One problem with DropDownChoice

2011-04-15 Thread tech7
Any suggestion?

-
Wicket-Java
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choose-One-problem-with-DropDownChoice-tp3451837p3452096.html
Sent from the Users forum mailing list archive at Nabble.com.

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



problem with dropdownchoice and setType(Integer.class)

2010-08-18 Thread Jarkko Rantamaki
Hello!

I got confused on what is the intended behavior of the dropdownchoice
with integers.

I wanted to create a dropdownchoice, which would list a range of
integers for user to select.

It seems to me, that if I call the setType(Integer.class), then it
changes the way it is processed when I submit. The dropdownchoice will
get the index value in the model instead of the value that the user
selected in the dropdownchoice. If I remove the call to the
setType-method, then the value which gets passed to the under
lying  model is what I select in the dropdownchoice.

Here is what I did:


public class TestPage extends WebPage {

public TestPage() {
Form form = new Form("form");

List choices = new ArrayList();
for(int i =5; i < 10; i++) {
choices.add(new Integer(i));
}
Model integerModel  = new Model(5){
@Override
public void setObject(Integer object) {
super.setObject(object);
System.err.println("Setting the model
object: "+ object);   
}
};
DropDownChoice myDropDownChoice = 
new DropDownChoice("myDropDownChoice",
integerModel,
choices);

// If you comment out the setType()-call,
// then it works as I would expect.
myDropDownChoice.setType(Integer.class); 

form.add(myDropDownChoice);
this.add(form);
}; 
}

Is it a bad idea to call the setType() method or am I doing something
else wrong?

My wicket version was 1.4.10

Br,
Jarkko




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



Re: problem with dropdownchoice

2009-01-20 Thread jWeekend

Be careful - that code is becoming very messy. 
It's better to 
http://cwiki.apache.org/WICKET/working-with-wicket-models.html read about
how to use models  rather than invent adhoc and unorthodox methods like
getDevices() that returns one device (rather than a collection containing 0,
1 or more devices) just so you can make this work. 

For your case/code read about CompoundPropertyModel - you have not given
your DDC a model so it is looking up the (containment) hierarchy for a
CompoundPropertyModel and it will try to bind to a "devices" property on
that CompoundPropertyModel's object).

Regards - Cemal
http://www.jWeekend.com jWeekend 





itayke wrote:
> 
> Hi,
> 
> Seem like the problem is solved by adding a "Device" class member and
> these getter and setter to the FormInput class:
> 
>   public Device getDevices(){
>   return new Device();
>   }
>   
>   
>   public void setDevices(Device d){
>   device = d;
>   }
> 
> 
> thanks for your help.
> 
> 
> 
> 
> 
> Alex Objelean wrote:
>> 
>> 
>> Wicket expects that FormInput would have a getter for devices. This
>> happens because you are using CompoundPropertyModel with your
>> formthus the wicket id is automatically used as a propertyModel on
>> the form model object. 
>> 
>> Alex Objelean
>> 
>> 
>> itayke wrote:
>>> 
>>> Hi,
>>> 
>>> I have this problem with my dropdownchoice with results in 
>>> WicketMessage: No get method defined for class: class
>>> screens.CustomerFilters$FormInput expression: devices
>>> 
>>> were the java class has:
>>> 
>>> public CustomerFilters(){
>>> super();
>>> FormInput formInput = new FormInput("Form");
>>> setModel(new CompoundPropertyModel(formInput));
>>> add(formInput);
>>>..
>>> 
>>>  }
>>> 
>>> 
>>> and the form class:
>>> 
>>> public class FormInput extends Form{
>>> 
>>> String deviceID;
>>> 
>>> public FormInput(String id) {
>>> super(id);
>>> 
>>> DropDownChoice ddc = 
>>> new DropDownChoice("devices", 
>>> getDevicesList(), //this will 
>>> return a list of Device POJOs
>>> new IChoiceRenderer() { 
>>> public Object getDisplayValue(Object 
>>> object) { 
>>> return 
>>> ((Device)object).getDeviceName(); 
>>> } 
>>> public String getIdValue(Object object, 
>>> int index) { 
>>> return 
>>> ((Device)object).getDeviceID(); 
>>> } 
>>> }); 
>>> 
>>> add(ddc);
>>> }
>>> 
>>> I also have a simple "Device" POJO class with getters and setters.
>>> The HTML looks like that:
>>> 
>>> ...
>>> 
>>> 
>>> 
>>> Select Device
>>> 
>>> Some device
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ...
>>> 
>>> 
>>> 
>>> Any ideas what i'm doing wrong?
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21565122.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: problem with dropdownchoice

2009-01-20 Thread itayke

Hi,

Seem like the problem is solved by adding a "Device" class member and these
getter and setter to the FormInput class:

public Device getDevices(){
return new Device();
}


public void setDevices(Device d){
device = d;
}


thanks for your help.





Alex Objelean wrote:
> 
> 
> Wicket expects that FormInput would have a getter for devices. This
> happens because you are using CompoundPropertyModel with your formthus
> the wicket id is automatically used as a propertyModel on the form model
> object. 
> 
> Alex Objelean
> 
> 
> itayke wrote:
>> 
>> Hi,
>> 
>> I have this problem with my dropdownchoice with results in 
>> WicketMessage: No get method defined for class: class
>> screens.CustomerFilters$FormInput expression: devices
>> 
>> were the java class has:
>> 
>>  public CustomerFilters(){
>>  super();
>>  FormInput formInput = new FormInput("Form");
>>  setModel(new CompoundPropertyModel(formInput));
>>  add(formInput);
>>..
>> 
>>  }
>> 
>> 
>> and the form class:
>> 
>>  public class FormInput extends Form{
>> 
>>  String deviceID;
>>  
>>  public FormInput(String id) {
>>  super(id);
>>  
>>  DropDownChoice ddc = 
>>  new DropDownChoice("devices", 
>>  getDevicesList(), //this will 
>> return a list of Device POJOs
>>  new IChoiceRenderer() { 
>>  public Object getDisplayValue(Object 
>> object) { 
>>  return 
>> ((Device)object).getDeviceName(); 
>>  } 
>>  public String getIdValue(Object object, 
>> int index) { 
>>  return 
>> ((Device)object).getDeviceID(); 
>>  } 
>>  }); 
>> 
>>  add(ddc);
>>  }
>> 
>> I also have a simple "Device" POJO class with getters and setters.
>> The HTML looks like that:
>> 
>> ...
>> 
>> 
>> 
>> Select Device
>> 
>> Some device
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ...
>> 
>> 
>> 
>> Any ideas what i'm doing wrong?
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21564437.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: problem with dropdownchoice

2009-01-20 Thread Dipu
take a look at Wicket Examples -> FormInput

Dipu

On Tue, Jan 20, 2009 at 1:53 PM, itayke  wrote:
>
> Hi,
>
> I have this problem with my dropdownchoice with results in
> WicketMessage: No get method defined for class: class
> screens.CustomerFilters$FormInput expression: devices
>
> were the java class has:
>
>public CustomerFilters(){
>super();
>FormInput formInput = new FormInput("Form");
>setModel(new CompoundPropertyModel(formInput));
>add(formInput);
>   ..
>
> }
>
>
> and the form class:
>
>public class FormInput extends Form{
>
>String deviceID;
>
>public FormInput(String id) {
>super(id);
>
>DropDownChoice ddc =
>new DropDownChoice("devices",
>getDevicesList(), //this will 
> return a list of Device POJOs
>new IChoiceRenderer() {
>public Object getDisplayValue(Object 
> object) {
>return 
> ((Device)object).getDeviceName();
>}
>public String getIdValue(Object 
> object, int index) {
>return 
> ((Device)object).getDeviceID();
>}
>});
>
>add(ddc);
>}
>
> I also have a simple "Device" POJO class with getters and setters.
> The HTML looks like that:
>
> ...
> 
> 
> 
>Select Device
>
>Some device
>
>
> 
> 
> 
> 
>
> ...
>
>
>
> Any ideas what i'm doing wrong?
>
> --
> View this message in context: 
> http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21563513.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: problem with dropdownchoice

2009-01-20 Thread Alex Objelean


Wicket expects that FormInput would have a getter for devices. This happens
because you are using CompoundPropertyModel with your formthus the
wicket id is automatically used as a propertyModel on the form model object. 

Alex Objelean


itayke wrote:
> 
> Hi,
> 
> I have this problem with my dropdownchoice with results in 
> WicketMessage: No get method defined for class: class
> screens.CustomerFilters$FormInput expression: devices
> 
> were the java class has:
> 
>   public CustomerFilters(){
>   super();
>   FormInput formInput = new FormInput("Form");
>   setModel(new CompoundPropertyModel(formInput));
>   add(formInput);
>..
> 
>  }
> 
> 
> and the form class:
> 
>   public class FormInput extends Form{
> 
>   String deviceID;
>   
>   public FormInput(String id) {
>   super(id);
>   
>   DropDownChoice ddc = 
>   new DropDownChoice("devices", 
>   getDevicesList(), //this will 
> return a list of Device POJOs
>   new IChoiceRenderer() { 
>   public Object getDisplayValue(Object 
> object) { 
>   return 
> ((Device)object).getDeviceName(); 
>   } 
>   public String getIdValue(Object object, 
> int index) { 
>   return 
> ((Device)object).getDeviceID(); 
>   } 
>   }); 
> 
>   add(ddc);
>   }
> 
> I also have a simple "Device" POJO class with getters and setters.
> The HTML looks like that:
> 
> ...
> 
> 
> 
>     Select Device
> 
> Some device
> 
> 
> 
> 
> 
> 
> 
> ...
> 
> 
> 
> Any ideas what i'm doing wrong?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21563790.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



problem with dropdownchoice

2009-01-20 Thread itayke

Hi,

I have this problem with my dropdownchoice with results in 
WicketMessage: No get method defined for class: class
screens.CustomerFilters$FormInput expression: devices

were the java class has:

public CustomerFilters(){
super();
FormInput formInput = new FormInput("Form");
setModel(new CompoundPropertyModel(formInput));
add(formInput);
   ..

 }


and the form class:

public class FormInput extends Form{

String deviceID;

public FormInput(String id) {
super(id);

DropDownChoice ddc = 
new DropDownChoice("devices", 
getDevicesList(), //this will 
return a list of Device POJOs
new IChoiceRenderer() { 
public Object getDisplayValue(Object 
object) { 
return 
((Device)object).getDeviceName(); 
} 
public String getIdValue(Object object, 
int index) { 
return 
((Device)object).getDeviceID(); 
} 
}); 

add(ddc);
}

I also have a simple "Device" POJO class with getters and setters.
The HTML looks like that:

...



Select Device

Some device







...



Any ideas what i'm doing wrong?

-- 
View this message in context: 
http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21563513.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: SOLVED Re: Problem with DropDownChoice on 1.4M3

2008-09-17 Thread Daan van Etten

Great you figured it out!
Some problems have simple solutions...

Regards,

Daan

On 17 sep 2008, at 16:07, Anders Peterson wrote:

Isn't it always like this; as soon as you ask someone you start  
thinking about the problem differently. Or should I say you start  
thinking straight. The problem was, of course, with the equals- 
method of the listed objects (two instances of that class would  
never be equal).


Thanks for being there! /Anders

Anders Peterson wrote:

This is the code that creates the DropDownChoice:
myForm.add(new DropDownChoice("views",  
this.getPortfolio().getViews(), new  
ChoiceRenderer("toDisplayString")) {

   @Override
   protected void onSelectionChanged(BLView newSelection) {
   super.onSelectionChanged(newSelection);
   ...;
   }
   @Override
   protected boolean wantOnSelectionChangedNotifications() {
   return true;
   }
   });
Nothing strange... /Anders
Daan van Etten wrote:

On 17 sep 2008, at 14:55, Anders Peterson wrote:

My DropDownChoice always displays as if nothing is selected.  
Using it works fine, but every time the page is (re)loaded the  
selection is reset.


wantOnSelectionChangedNotifications return true.

I have an older version of my app deployed (using an older  
version of Wicket) that works as expected.


Is this a known problem or could I be doing something wrong?


You could be doing something wrong. Do you set the model of the  
DropDownChoice?

Show us some code.

Regards,

Daan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SOLVED Re: Problem with DropDownChoice on 1.4M3

2008-09-17 Thread Anders Peterson
Isn't it always like this; as soon as you ask someone you start thinking 
about the problem differently. Or should I say you start thinking 
straight. The problem was, of course, with the equals-method of the 
listed objects (two instances of that class would never be equal).


Thanks for being there! /Anders

Anders Peterson wrote:

This is the code that creates the DropDownChoice:

myForm.add(new DropDownChoice("views", 
this.getPortfolio().getViews(), new 
ChoiceRenderer("toDisplayString")) {


@Override
protected void onSelectionChanged(BLView newSelection) {

super.onSelectionChanged(newSelection);

...;
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}

});


Nothing strange... /Anders


Daan van Etten wrote:

On 17 sep 2008, at 14:55, Anders Peterson wrote:

My DropDownChoice always displays as if nothing is selected. Using it 
works fine, but every time the page is (re)loaded the selection is 
reset.


wantOnSelectionChangedNotifications return true.

I have an older version of my app deployed (using an older version of 
Wicket) that works as expected.


Is this a known problem or could I be doing something wrong?


You could be doing something wrong. Do you set the model of the 
DropDownChoice?

Show us some code.

Regards,

Daan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice on 1.4M3

2008-09-17 Thread Anders Peterson

This is the code that creates the DropDownChoice:

myForm.add(new DropDownChoice("views", 
this.getPortfolio().getViews(), new 
ChoiceRenderer("toDisplayString")) {


@Override
protected void onSelectionChanged(BLView newSelection) {

super.onSelectionChanged(newSelection);

...;
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}

});


Nothing strange... /Anders


Daan van Etten wrote:

On 17 sep 2008, at 14:55, Anders Peterson wrote:

My DropDownChoice always displays as if nothing is selected. Using it 
works fine, but every time the page is (re)loaded the selection is reset.


wantOnSelectionChangedNotifications return true.

I have an older version of my app deployed (using an older version of 
Wicket) that works as expected.


Is this a known problem or could I be doing something wrong?


You could be doing something wrong. Do you set the model of the 
DropDownChoice?

Show us some code.

Regards,

Daan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice on 1.4M3

2008-09-17 Thread Daan van Etten

On 17 sep 2008, at 14:55, Anders Peterson wrote:

My DropDownChoice always displays as if nothing is selected. Using  
it works fine, but every time the page is (re)loaded the selection  
is reset.


wantOnSelectionChangedNotifications return true.

I have an older version of my app deployed (using an older version  
of Wicket) that works as expected.


Is this a known problem or could I be doing something wrong?


You could be doing something wrong. Do you set the model of the  
DropDownChoice?

Show us some code.

Regards,

Daan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with DropDownChoice on 1.4M3

2008-09-17 Thread Anders Peterson
My DropDownChoice always displays as if nothing is selected. Using it 
works fine, but every time the page is (re)loaded the selection is reset.


wantOnSelectionChangedNotifications return true.

I have an older version of my app deployed (using an older version of 
Wicket) that works as expected.


Is this a known problem or could I be doing something wrong?

/Anders


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-07 Thread JulianS

Thank you Carlos! This was exactly what I needed to do.

Julian


Carlos Pita-4 wrote:
> 
> protected void onUpdate(AjaxRequestTarget target) {
> dropDown2.clearInput();  <--- reset input !!!
> dropDown2.setModelObject(null);
> target.addComponent(dropDown2);
> }
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12561183
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Carlos Pita
That's because of JualianS' use case. Changing the first dropdown
should reset the second and third ones' model to null. Maybe it's a
Country/State/City trio. Suppose the model of the first was
"Argentina" and the model of the second was "Buenos Aires" when
submission was done (of course, this is possible because the
individual dropdown models are being updated by means of updating
behaviors before form submission). Validation fails due to some other
reason, then you set country to -say- "Afghanistan", and try to reset
the state model from the same onchange updating behavior. But as state
it's still reading its value from the raw input "Buenos Aires", you
won't get it resetted until you also clear this input.

Regards,
Carlos

On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> so the validation fails yet you are still updating the models???
>
> -igor
>
>
> On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> >
> > I've debugged a simple example and what I described before happens to
> > the letter, both for ajax updating behavior and for
> > wantOnSelectionChangedNotifications/onSelectionChanged. I don't think
> > it's a bug at all, but imo it would be reasonable to clear out the
> > input if the explicit intention of changing the formcomponent value
> > (through the model object in this case) is there. Anyway, maybe this
> > is not related to JulianS' problem.
> >
> > Do you want the example?
> >
> > Regards,
> > Carlos
> >
> >
> > On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > does it work properly without ajax?
> > >
> > > -igor
> > >
> > >
> > > On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other
> > fields)
> > > > on
> > > > a form.
> > > >
> > > > The first DropDownChoice resets the selections in the other
> > > > DropDownChoices
> > > > using AjaxFormComponentUpdatingBehavior("onchange"). All the
> > > > DropDownChoices
> > > > use PropertyModels.
> > > >
> > > > This all works fine until the form is submitted and validation fails.
> > In
> > > > this (normal) situation the form is still visible, with the feedback
> > > > messages displayed, but the 2nd and 3rd DropDownChoices no longer
> > react to
> > > > the first DropDownChoice. I have verified that the properties on which
> > > > DropDownChoices depend are being correctly set.
> > > >
> > > > Is there anything I can do to make them behave properly? Any help is
> > > > appreciated.
> > > >
> > > > Thanks,
> > > > Julian
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> > > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > > >
> > > >
> > > > -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Igor Vaynberg
so the validation fails yet you are still updating the models???

-igor


On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
>
> I've debugged a simple example and what I described before happens to
> the letter, both for ajax updating behavior and for
> wantOnSelectionChangedNotifications/onSelectionChanged. I don't think
> it's a bug at all, but imo it would be reasonable to clear out the
> input if the explicit intention of changing the formcomponent value
> (through the model object in this case) is there. Anyway, maybe this
> is not related to JulianS' problem.
>
> Do you want the example?
>
> Regards,
> Carlos
>
>
> On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > does it work properly without ajax?
> >
> > -igor
> >
> >
> > On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other
> fields)
> > > on
> > > a form.
> > >
> > > The first DropDownChoice resets the selections in the other
> > > DropDownChoices
> > > using AjaxFormComponentUpdatingBehavior("onchange"). All the
> > > DropDownChoices
> > > use PropertyModels.
> > >
> > > This all works fine until the form is submitted and validation fails.
> In
> > > this (normal) situation the form is still visible, with the feedback
> > > messages displayed, but the 2nd and 3rd DropDownChoices no longer
> react to
> > > the first DropDownChoice. I have verified that the properties on which
> > > DropDownChoices depend are being correctly set.
> > >
> > > Is there anything I can do to make them behave properly? Any help is
> > > appreciated.
> > >
> > > Thanks,
> > > Julian
> > >
> > > --
> > > View this message in context:
> > >
> http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Carlos Pita
I've debugged a simple example and what I described before happens to
the letter, both for ajax updating behavior and for
wantOnSelectionChangedNotifications/onSelectionChanged. I don't think
it's a bug at all, but imo it would be reasonable to clear out the
input if the explicit intention of changing the formcomponent value
(through the model object in this case) is there. Anyway, maybe this
is not related to JulianS' problem.

Do you want the example?

Regards,
Carlos


On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> does it work properly without ajax?
>
> -igor
>
>
> On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
> >
> >
> > I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields)
> > on
> > a form.
> >
> > The first DropDownChoice resets the selections in the other
> > DropDownChoices
> > using AjaxFormComponentUpdatingBehavior("onchange"). All the
> > DropDownChoices
> > use PropertyModels.
> >
> > This all works fine until the form is submitted and validation fails. In
> > this (normal) situation the form is still visible, with the feedback
> > messages displayed, but the 2nd and 3rd DropDownChoices no longer react to
> > the first DropDownChoice. I have verified that the properties on which
> > DropDownChoices depend are being correctly set.
> >
> > Is there anything I can do to make them behave properly? Any help is
> > appreciated.
> >
> > Thanks,
> > Julian
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Igor Vaynberg
does it work properly without ajax?

-igor


On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
>
>
> I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields)
> on
> a form.
>
> The first DropDownChoice resets the selections in the other
> DropDownChoices
> using AjaxFormComponentUpdatingBehavior("onchange"). All the
> DropDownChoices
> use PropertyModels.
>
> This all works fine until the form is submitted and validation fails. In
> this (normal) situation the form is still visible, with the feedback
> messages displayed, but the 2nd and 3rd DropDownChoices no longer react to
> the first DropDownChoice. I have verified that the properties on which
> DropDownChoices depend are being correctly set.
>
> Is there anything I can do to make them behave properly? Any help is
> appreciated.
>
> Thanks,
> Julian
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Carlos Pita
Now that I think about it: maybe input should be automatically cleared
out in case the model is explicitly changed, don't you think?

On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> Maybe it's because your second and third dropdowns are taking their
> input from the posted parameters (the raw input) instead of from their
> model. See the source for FormComponent.getValue():
>
> if (NO_RAW_INPUT.equals(rawInput))
> {
> return getModelValue();
> }
> else
> {
> if (getEscapeModelStrings() && rawInput != null)
> {
> return 
> Strings.escapeMarkup(rawInput).toString();
> }
> return rawInput;
> }
>
> After submit, your dropdowns are probably taking the second branch. So
> in your updating behavior, try something like:
>
> protected void onUpdate(AjaxRequestTarget target) {
> dropDown2.clearInput();  <--- reset input !!!
> dropDown2.setModelObject(null);
> target.addComponent(dropDown2);
> }
>
> This not only sets the second dropdown model to null but also resets its 
> input.
>
> Regards,
> Carlos
>
> On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
> >
> > I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on
> > a form.
> >
> > The first DropDownChoice resets the selections in the other DropDownChoices
> > using AjaxFormComponentUpdatingBehavior("onchange"). All the DropDownChoices
> > use PropertyModels.
> >
> > This all works fine until the form is submitted and validation fails. In
> > this (normal) situation the form is still visible, with the feedback
> > messages displayed, but the 2nd and 3rd DropDownChoices no longer react to
> > the first DropDownChoice. I have verified that the properties on which
> > DropDownChoices depend are being correctly set.
> >
> > Is there anything I can do to make them behave properly? Any help is
> > appreciated.
> >
> > Thanks,
> > Julian
> >
> > --
> > View this message in context: 
> > http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread Carlos Pita
Maybe it's because your second and third dropdowns are taking their
input from the posted parameters (the raw input) instead of from their
model. See the source for FormComponent.getValue():

if (NO_RAW_INPUT.equals(rawInput))
{
return getModelValue();
}
else
{
if (getEscapeModelStrings() && rawInput != null)
{
return 
Strings.escapeMarkup(rawInput).toString();
}
return rawInput;
}

After submit, your dropdowns are probably taking the second branch. So
in your updating behavior, try something like:

protected void onUpdate(AjaxRequestTarget target) {
dropDown2.clearInput();  <--- reset input !!!
dropDown2.setModelObject(null);
target.addComponent(dropDown2);
}

This not only sets the second dropdown model to null but also resets its input.

Regards,
Carlos

On 9/6/07, JulianS <[EMAIL PROTECTED]> wrote:
>
> I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on
> a form.
>
> The first DropDownChoice resets the selections in the other DropDownChoices
> using AjaxFormComponentUpdatingBehavior("onchange"). All the DropDownChoices
> use PropertyModels.
>
> This all works fine until the form is submitted and validation fails. In
> this (normal) situation the form is still visible, with the feedback
> messages displayed, but the 2nd and 3rd DropDownChoices no longer react to
> the first DropDownChoice. I have verified that the properties on which
> DropDownChoices depend are being correctly set.
>
> Is there anything I can do to make them behave properly? Any help is
> appreciated.
>
> Thanks,
> Julian
>
> --
> View this message in context: 
> http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior

2007-09-06 Thread JulianS

I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on
a form. 

The first DropDownChoice resets the selections in the other DropDownChoices
using AjaxFormComponentUpdatingBehavior("onchange"). All the DropDownChoices
use PropertyModels.

This all works fine until the form is submitted and validation fails. In
this (normal) situation the form is still visible, with the feedback
messages displayed, but the 2nd and 3rd DropDownChoices no longer react to
the first DropDownChoice. I have verified that the properties on which
DropDownChoices depend are being correctly set.

Is there anything I can do to make them behave properly? Any help is
appreciated.

Thanks,
Julian

-- 
View this message in context: 
http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]