Hi,

Does anybody have ideas how to solve this by *not* updating the form?

I'm running into the same issue when putting an OnChangeAjaxBehavior
on a TextField inside a form (triggered only once). The component to
be updated is outside the form.

Updating the form like suggested "solves" the issue; however, when the
user types in text in this textfield and the form is constantly
updated, this means text will get lost. Adjusting the throttle delay
helps, but not enough. I just cannot update the form part via AJAX. So
are there any other ways to fix this problem?


Antoine.


On Wed, Mar 18, 2009 at 3:22 PM, Filippo De Luca
<[email protected]> wrote:
> Hi wicketers,
> I have fixed this issue by including form in target component:
>
>        private void registerBehaviors() {
>            userAgentField.add(new OnChangeAjaxBehavior() {
>
>               �...@override
>                protected void onUpdate(AjaxRequestTarget target) {
>
>                    logger.debug("AJAX matching user agent");
>
>                    matchUserAgent();
>                    target.addComponent(resultPanel);
>                    target.addComponent(matchingForm);
>                }
>            });
>        }
>
> I've found this mail:
> http://www.nabble.com/OnChangeAjaxBehavior-receives-only-first-input-character-td20207317.html,
> it is the same issue.
>
> It is this behavior default? or it is an issue?
>
> 2009/3/18 Filippo De Luca <[email protected]>
>
>> Hi,
>> I have a panel MatchingPanel with a form and a result div:
>>
>>         <wicket:panel>
>>
>>             <form wicket:id="form" action="#">
>>                 <div class="widget">
>>                     <label><wicket:message
>> key="form.userAgent">[form.userAgent]</wicket:message></label>
>>                     <input wicket:id="userAgent" class="userAgent"
>> type="text" maxlength="255" />
>>                 </div>
>>                 <div class="buttons">
>>                     <input type="submit" value="Match"
>> wicket:message="value:form.match" />
>>                 </div>
>>             </form>
>>             <div wicket:id="result" >
>>                 <div>
>>                     <label><wicket:message
>> key="result.matchedUserAgent">[result.matchedUserAgent]</wicket:message></label>
>>                     <span
>> wicket:id="matchedUserAgent">[sourceUserAgent]</span>
>>                 </div>
>>             </div>
>>         </wicket:panel>
>>
>> while my java code is:
>>
>>     class MatchingForm extends Form<Object> {
>>
>> ...
>>
>>         private void registerBehaviors() {
>>             userAgentField.add(new OnChangeAjaxBehavior() {
>>
>>                 @Override
>>                 protected void onUpdate(AjaxRequestTarget target) {
>>
>>                     logger.debug("AJAX matching user agent");
>>
>>                     matchUserAgent();
>>                     target.addComponent(resultPanel);
>>                 }
>>             });
>>         }
>>
>> ...
>>
>>         private void matchUserAgent() {
>>
>>             String userAgent = userAgentModel.getObject();
>>             WURFLManager wurflManager = getWurflManager();
>>
>>             MatchingResult result = null;
>>
>>             if (StringUtils.isNotBlank(userAgent)) {
>>
>>                 Instant start = new Instant();
>>                 Device device =
>> wurflManager.getDeviceForRequest(userAgent);
>>                 Instant end = new Instant();
>>
>>                 Period duration = new Period(start, end);
>>                 result = new MatchingResult(userAgent, device, (long)
>> duration
>>                         .getMillis());
>>
>>             }
>>             resultPanel.setResult(result);
>>
>>         }
>>
>>     }
>>
>> The OnChangeBehaviour is called only the first time the userAgent field
>> take the focus. To call other time, i have to lost focus and give focus to
>> userAgent input text. Why? The target component is outside the frm, it is an
>> issue?
>>
>> Thank you
>>
>> --
>> Filippo De Luca
>> --------------------------
>> Email: [email protected]
>> Web:   http://www.filosganga.it
>> LinkedIn: http://www.linkedin.com/in/filippodeluca
>> mobile: +393395822588
>>
>
>
>
> --
> Filippo De Luca
> --------------------------
> Email: [email protected]
> Web:   http://www.filosganga.it
> LinkedIn: http://www.linkedin.com/in/filippodeluca
> mobile: +393395822588
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to