You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anders Peterson <an...@optimatika.se> on 2011/10/13 12:40:37 UTC

Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Hi,

Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.

I have a page with a form. Inside the form there is a repetition (ListView) that among other things creates a text field for each item (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that should update a label. The label should continously display the total sum of the numbers in the text fields.

With wicket 1.4.18 (and previous versions) this worked fine.

With 1.5.1 only the first text field in the repetition gets the correct ajax behavior - it works the way I want it, and the way it worked with 1.4.*. The other text fields are "dead", except for focus set/removed. While typing in any of the other text fields nothing is updated (the ajax debug window shows no activity). When focus is removed I get a NullPointerException regardless of what I've changed.

Is this a (known) bug, or is there a difference between 1.4 and 1.5 that I've missed?

/Anders



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


Re: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,

can you attach the code you use to initialize ListView?
> Hi,
>
> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>
> I have a page with a form. Inside the form there is a repetition (ListView) that among other things creates a text field for each item (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that should update a label. The label should continously display the total sum of the numbers in the text fields.
>
> With wicket 1.4.18 (and previous versions) this worked fine.
>
> With 1.5.1 only the first text field in the repetition gets the correct ajax behavior - it works the way I want it, and the way it worked with 1.4.*. The other text fields are "dead", except for focus set/removed. While typing in any of the other text fields nothing is updated (the ajax debug window shows no activity). When focus is removed I get a NullPointerException regardless of what I've changed.
>
> Is this a (known) bug, or is there a difference between 1.4 and 1.5 that I've missed?
>
> /Anders
>
>
>
> ---------------------------------------------------------------------
> 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: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
I've tried to reproduce your condition in a quickstart. The Java code is 
the following:


List<String> itemList = Arrays.asList(new String[]{"red", "blue", 
"green", "yellow"});
         final Label label;
         add(label = new Label("label", ""));
         label.setOutputMarkupId(true);

         ListView<String> colors = new ListView<String>("colors", itemList){

             @Override
             protected void populateItem(ListItem<String> item) {
                 String value = item.getModelObject();
                 final TextField text;
                 item.add(text = new TextField("value", Model.of("")));

                 text.add(new OnChangeAjaxBehavior(){

                     @Override
                     protected void onUpdate(AjaxRequestTarget target) {
                         
target.add(label.setDefaultModelObject(text.getModelObject()));
                     }
                 });
             }
         };

         colors.setOutputMarkupId(true);
         colors.setReuseItems(true);
         add(colors);


and the markup is


<body>
<div id="hd">
<div id="logo">
<img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
<h1>Apache Wicket</h1>
</div>
</div>
<span wicket:id="label"></span>
<div wicket:id="colors">
<input type="text" wicket:id="value"/>
</div>
</body>


However I didn't notice any problem, it works as expected. Maybe the 
problem is inside one of your custom components (ContextLabel, 
ContextTextField, ...)

> Here the (simplified) code that creates the ListViev, TextFields and Label. /Anders
>
>
>
>
>
>
>
> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>
>> Hi,
>>
>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>
>> I have a page with a form. Inside the form there is a repetition (ListView) that among other things creates a text field for each item (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that should update a label. The label should continously display the total sum of the numbers in the text fields.
>>
>> With wicket 1.4.18 (and previous versions) this worked fine.
>>
>> With 1.5.1 only the first text field in the repetition gets the correct ajax behavior - it works the way I want it, and the way it worked with 1.4.*. The other text fields are "dead", except for focus set/removed. While typing in any of the other text fields nothing is updated (the ajax debug window shows no activity). When focus is removed I get a NullPointerException regardless of what I've changed.
>>
>> Is this a (known) bug, or is there a difference between 1.4 and 1.5 that I've missed?
>>
>> /Anders
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


Re: Solved: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by James Carman <ja...@carmanconsulting.com>.
This is what I love about Wicketeers.  They don't just sit around
complaining about something; they jump in and help fix it!  Way to go
Wicket community!

On Sat, Dec 17, 2011 at 7:49 AM, Martin Grigorov <mg...@apache.org> wrote:
> On Sat, Dec 17, 2011 at 12:58 AM, Dan Retzlaff <dr...@gmail.com> wrote:
>> Yes, that broke our app during migration as well. I've added a migration
>> wiki entry.
>> https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-Component.getMarkupId%28%29implementationchanged
>
> Thanks, Dan!
>
>>
>>
>> On Fri, Dec 16, 2011 at 1:51 PM, Anders Peterson <ap...@optimatika.se>wrote:
>>
>>> The problem was in the html file.
>>>
>>> I used to have this:
>>>
>>> <input name="marketWeight" type="text" id="marketWeight" size="6"
>>> maxlength="6" wicket:id="marketWeight" />
>>>
>>> Needed to change that to:
>>>
>>> <input type="text" size="6" maxlength="6" wicket:id="marketWeight" />
>>>
>>>
>>> "marketWeight" is the component with the ajax behaviour, and it was in a
>>> ListView so I had several of them.
>>>
>>>
>>> I guess something related to replacing the name/id of a component changed
>>> from 1.4 to 1.5.
>>>
>>>
>>> /Anders
>>>
>>>
>>> On 2011-12-16 14:15, Anders Peterson wrote:
>>>
>>>> Hello again, I still have this problem... (been working on other things)
>>>>
>>>> I've tracked the problem back to the request parameters simply not
>>>> containing the expected values.
>>>>
>>>> This "input name" seems correct since I changed the market weight
>>>> attribute of the second instrument:
>>>> instruments:1:marketWeight
>>>>
>>>> But the HashMap containing parameter values ONLY contain this:
>>>> {instruments:0:marketWeight=[**17.602]}
>>>>
>>>> This results in me getting null as FormComponent input.
>>>>
>>>> Anyone know what I've done wrong?
>>>>
>>>> /Anders
>>>>
>>>>
>>>> On 2011-10-13 13:46, Anders Peterson wrote:
>>>>
>>>>> Here the (simplified) code that creates the ListViev, TextFields and
>>>>> Label. /Anders
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>>>>>
>>>>>  Hi,
>>>>>>
>>>>>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>>>>>
>>>>>> I have a page with a form. Inside the form there is a repetition
>>>>>> (ListView) that among other things creates a text field for each item
>>>>>> (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that
>>>>>> should update a label. The label should continously display the total sum
>>>>>> of the numbers in the text fields.
>>>>>>
>>>>>> With wicket 1.4.18 (and previous versions) this worked fine.
>>>>>>
>>>>>> With 1.5.1 only the first text field in the repetition gets the correct
>>>>>> ajax behavior - it works the way I want it, and the way it worked with
>>>>>> 1.4.*. The other text fields are "dead", except for focus set/removed.
>>>>>> While typing in any of the other text fields nothing is updated (the ajax
>>>>>> debug window shows no activity). When focus is removed I get a
>>>>>> NullPointerException regardless of what I've changed.
>>>>>>
>>>>>> Is this a (known) bug, or is there a difference between 1.4 and 1.5
>>>>>> that I've missed?
>>>>>>
>>>>>> /Anders
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------**------------------------------**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> 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: Solved: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Dec 17, 2011 at 12:58 AM, Dan Retzlaff <dr...@gmail.com> wrote:
> Yes, that broke our app during migration as well. I've added a migration
> wiki entry.
> https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-Component.getMarkupId%28%29implementationchanged

Thanks, Dan!

>
>
> On Fri, Dec 16, 2011 at 1:51 PM, Anders Peterson <ap...@optimatika.se>wrote:
>
>> The problem was in the html file.
>>
>> I used to have this:
>>
>> <input name="marketWeight" type="text" id="marketWeight" size="6"
>> maxlength="6" wicket:id="marketWeight" />
>>
>> Needed to change that to:
>>
>> <input type="text" size="6" maxlength="6" wicket:id="marketWeight" />
>>
>>
>> "marketWeight" is the component with the ajax behaviour, and it was in a
>> ListView so I had several of them.
>>
>>
>> I guess something related to replacing the name/id of a component changed
>> from 1.4 to 1.5.
>>
>>
>> /Anders
>>
>>
>> On 2011-12-16 14:15, Anders Peterson wrote:
>>
>>> Hello again, I still have this problem... (been working on other things)
>>>
>>> I've tracked the problem back to the request parameters simply not
>>> containing the expected values.
>>>
>>> This "input name" seems correct since I changed the market weight
>>> attribute of the second instrument:
>>> instruments:1:marketWeight
>>>
>>> But the HashMap containing parameter values ONLY contain this:
>>> {instruments:0:marketWeight=[**17.602]}
>>>
>>> This results in me getting null as FormComponent input.
>>>
>>> Anyone know what I've done wrong?
>>>
>>> /Anders
>>>
>>>
>>> On 2011-10-13 13:46, Anders Peterson wrote:
>>>
>>>> Here the (simplified) code that creates the ListViev, TextFields and
>>>> Label. /Anders
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>>>>
>>>>  Hi,
>>>>>
>>>>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>>>>
>>>>> I have a page with a form. Inside the form there is a repetition
>>>>> (ListView) that among other things creates a text field for each item
>>>>> (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that
>>>>> should update a label. The label should continously display the total sum
>>>>> of the numbers in the text fields.
>>>>>
>>>>> With wicket 1.4.18 (and previous versions) this worked fine.
>>>>>
>>>>> With 1.5.1 only the first text field in the repetition gets the correct
>>>>> ajax behavior - it works the way I want it, and the way it worked with
>>>>> 1.4.*. The other text fields are "dead", except for focus set/removed.
>>>>> While typing in any of the other text fields nothing is updated (the ajax
>>>>> debug window shows no activity). When focus is removed I get a
>>>>> NullPointerException regardless of what I've changed.
>>>>>
>>>>> Is this a (known) bug, or is there a difference between 1.4 and 1.5
>>>>> that I've missed?
>>>>>
>>>>> /Anders
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Solved: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Dan Retzlaff <dr...@gmail.com>.
Yes, that broke our app during migration as well. I've added a migration
wiki entry.
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-Component.getMarkupId%28%29implementationchanged


On Fri, Dec 16, 2011 at 1:51 PM, Anders Peterson <ap...@optimatika.se>wrote:

> The problem was in the html file.
>
> I used to have this:
>
> <input name="marketWeight" type="text" id="marketWeight" size="6"
> maxlength="6" wicket:id="marketWeight" />
>
> Needed to change that to:
>
> <input type="text" size="6" maxlength="6" wicket:id="marketWeight" />
>
>
> "marketWeight" is the component with the ajax behaviour, and it was in a
> ListView so I had several of them.
>
>
> I guess something related to replacing the name/id of a component changed
> from 1.4 to 1.5.
>
>
> /Anders
>
>
> On 2011-12-16 14:15, Anders Peterson wrote:
>
>> Hello again, I still have this problem... (been working on other things)
>>
>> I've tracked the problem back to the request parameters simply not
>> containing the expected values.
>>
>> This "input name" seems correct since I changed the market weight
>> attribute of the second instrument:
>> instruments:1:marketWeight
>>
>> But the HashMap containing parameter values ONLY contain this:
>> {instruments:0:marketWeight=[**17.602]}
>>
>> This results in me getting null as FormComponent input.
>>
>> Anyone know what I've done wrong?
>>
>> /Anders
>>
>>
>> On 2011-10-13 13:46, Anders Peterson wrote:
>>
>>> Here the (simplified) code that creates the ListViev, TextFields and
>>> Label. /Anders
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>>>
>>>  Hi,
>>>>
>>>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>>>
>>>> I have a page with a form. Inside the form there is a repetition
>>>> (ListView) that among other things creates a text field for each item
>>>> (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that
>>>> should update a label. The label should continously display the total sum
>>>> of the numbers in the text fields.
>>>>
>>>> With wicket 1.4.18 (and previous versions) this worked fine.
>>>>
>>>> With 1.5.1 only the first text field in the repetition gets the correct
>>>> ajax behavior - it works the way I want it, and the way it worked with
>>>> 1.4.*. The other text fields are "dead", except for focus set/removed.
>>>> While typing in any of the other text fields nothing is updated (the ajax
>>>> debug window shows no activity). When focus is removed I get a
>>>> NullPointerException regardless of what I've changed.
>>>>
>>>> Is this a (known) bug, or is there a difference between 1.4 and 1.5
>>>> that I've missed?
>>>>
>>>> /Anders
>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Solved: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Anders Peterson <ap...@optimatika.se>.
The problem was in the html file.

I used to have this:

<input name="marketWeight" type="text" id="marketWeight" size="6" maxlength="6" 
wicket:id="marketWeight" />

Needed to change that to:

<input type="text" size="6" maxlength="6" wicket:id="marketWeight" />


"marketWeight" is the component with the ajax behaviour, and it was in a 
ListView so I had several of them.


I guess something related to replacing the name/id of a component changed from 
1.4 to 1.5.


/Anders


On 2011-12-16 14:15, Anders Peterson wrote:
> Hello again, I still have this problem... (been working on other things)
>
> I've tracked the problem back to the request parameters simply not containing 
> the expected values.
>
> This "input name" seems correct since I changed the market weight attribute of 
> the second instrument:
> instruments:1:marketWeight
>
> But the HashMap containing parameter values ONLY contain this:
> {instruments:0:marketWeight=[17.602]}
>
> This results in me getting null as FormComponent input.
>
> Anyone know what I've done wrong?
>
> /Anders
>
>
> On 2011-10-13 13:46, Anders Peterson wrote:
>> Here the (simplified) code that creates the ListViev, TextFields and Label. 
>> /Anders
>>
>>
>>
>>
>>
>>
>> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>>
>>> Hi,
>>>
>>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>>
>>> I have a page with a form. Inside the form there is a repetition (ListView) 
>>> that among other things creates a text field for each item (ListItem). Each 
>>> of those text fields has an OnChangeAjaxBehavior set that should update a 
>>> label. The label should continously display the total sum of the numbers in 
>>> the text fields.
>>>
>>> With wicket 1.4.18 (and previous versions) this worked fine.
>>>
>>> With 1.5.1 only the first text field in the repetition gets the correct ajax 
>>> behavior - it works the way I want it, and the way it worked with 1.4.*. The 
>>> other text fields are "dead", except for focus set/removed. While typing in 
>>> any of the other text fields nothing is updated (the ajax debug window shows 
>>> no activity). When focus is removed I get a NullPointerException regardless 
>>> of what I've changed.
>>>
>>> Is this a (known) bug, or is there a difference between 1.4 and 1.5 that 
>>> I've missed?
>>>
>>> /Anders
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Anders Peterson <ap...@optimatika.se>.
Hello again, I still have this problem... (been working on other things)

I've tracked the problem back to the request parameters simply not containing 
the expected values.

This "input name" seems correct since I changed the market weight attribute of 
the second instrument:
instruments:1:marketWeight

But the HashMap containing parameter values ONLY contain this:
{instruments:0:marketWeight=[17.602]}

This results in me getting null as FormComponent input.

Anyone know what I've done wrong?

/Anders


On 2011-10-13 13:46, Anders Peterson wrote:
> Here the (simplified) code that creates the ListViev, TextFields and Label. /Anders
>
>
>
>
>
>
> On 13 okt 2011, at 12:40, Anders Peterson wrote:
>
>> Hi,
>>
>> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
>>
>> I have a page with a form. Inside the form there is a repetition (ListView) that among other things creates a text field for each item (ListItem). Each of those text fields has an OnChangeAjaxBehavior set that should update a label. The label should continously display the total sum of the numbers in the text fields.
>>
>> With wicket 1.4.18 (and previous versions) this worked fine.
>>
>> With 1.5.1 only the first text field in the repetition gets the correct ajax behavior - it works the way I want it, and the way it worked with 1.4.*. The other text fields are "dead", except for focus set/removed. While typing in any of the other text fields nothing is updated (the ajax debug window shows no activity). When focus is removed I get a NullPointerException regardless of what I've changed.
>>
>> Is this a (known) bug, or is there a difference between 1.4 and 1.5 that I've missed?
>>
>> /Anders
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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: Only the first TextField in a repetition gets correct OnChangeAjaxBehavior with 1.5.1

Posted by Anders Peterson <an...@optimatika.se>.
Here the (simplified) code that creates the ListViev, TextFields and Label. /Anders