You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Brian Diekelman (JIRA)" <ji...@apache.org> on 2008/06/03 19:58:45 UTC

[jira] Commented: (WICKET-1646) AjaxFormComponentUpdatingBehavior not working correctly when using IE 7

    [ https://issues.apache.org/jira/browse/WICKET-1646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602007#action_12602007 ] 

Brian Diekelman commented on WICKET-1646:
-----------------------------------------

Unfortunately the code that fixed Jarmar's IE7 broke ours.

We're on a similarly locked down configuration of IE 7 within our organization.  In this case this is going to break in any large organization that has ActiveX objects disabled.

Removing 'Wicket.Browser.isIELessThan7() &&' (as in Wicket 1.3.3) fixes the issue.

Because of how a lot of organizations lock down IE, it really should try as many options as possible before failing.  For instance, here's how a few ajax libraries do it:

MooTools:

return $try(function(){
  return new XMLHttpRequest();
}, function(){
  return new ActiveXObject('MSXML2.XMLHTTP');
});

- '$try' looks weird because it's a cross browser abstraction
- this will try to use a native XMLHttpRequest first, if that fails in any way it will revert to the ActiveXObject

JQuery:
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();

- those comments are from the jQuery devs... maybe they know something we don't?  They get a lot more eyes on their ajax stuff than we do...


> AjaxFormComponentUpdatingBehavior not working correctly when using IE 7
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1646
>                 URL: https://issues.apache.org/jira/browse/WICKET-1646
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: OS: Windows XP SP2
> ServletContainer: Jetty 6.1.6
> Browser: IE 7
>            Reporter: Jarmar Fowler
>            Assignee: Matej Knopp
>             Fix For: 1.3.4
>
>
> AjaxFormComponentUpdatingBehavior works with Firefox, but doesn't work when using IE7.  
> I also observed similar problems when using AjaxEventBehavior as well. 
> The error returned via the ajax debug console was: "Could not locate ajax transport. Your browser does not support the required XMLHttpRequest object or wicket could not gain access to it".
> Below is a simple example that should demonstrate the problem.
> Example.java
> ============================================================
> package example.page;
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.form.Form;
> import org.apache.wicket.markup.html.form.TextField;
> import org.apache.wicket.model.CompoundPropertyModel;
> import org.apache.wicket.model.PropertyModel;
> public class Example extends WebPage {
> 		 private int age;
> 		 public Example() {
> 		 		 Form form = new Form("form", new CompoundPropertyModel(this));
> 		 		 add(form);
> 		 		 final Label label = new Label("label", new PropertyModel(this, "age"));
> 		 		 label.setOutputMarkupId(true);
> 		 		 add(label);
> 		 		 final TextField age = new TextField("age");
> 		 		 age.add(new AjaxFormComponentUpdatingBehavior("onblur") {
> 		 		 		 /**
> 		 		 		  * 
> 		 		 		  */
> 		 		 		 private static final long serialVersionUID = 1L;
> 		 		 		 protected void onUpdate(AjaxRequestTarget target) {
> 		 		 		 		 System.out.println("onUpdate triggered");
> 		 		 		 		 target.addComponent(label);
> 		 		 		 }
> 		 		 });
> 		 		 form.add(age);
> 		 }
> 		 public int getAge() {
> 		 		 return age;
> 		 }
> 		 public void setAge(int age) {
> 		 		 this.age = age;
> 		 }
> }
> Example.html
> ==================================================
> <html>
> <head>
> 		 <title>Test</title>
> </head>
> <body>
> 		 <div>
> 		 		 <label wicket:id="label">My Label Goes Here</label>
> 		 </div>
> 		 <form wicket:id="form">
> 		 		 <div>Age: <input type="text" wicket:id="age" /></div>
> 		 		 <div>
> 		 		 		 <input type="submit" value="Submit" />
> 		 		 </div>
> 		 </form>
> </body>
> </html>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.