Results 1 to 3 of 3

Thread: Checkbox returns true when unchecked (vice versa) on Chrome

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    18

    Default Checkbox returns true when unchecked (vice versa) on Chrome

    I am using a checkbox to enable/disable some widgets (e.g. textfield as shown in the example).
    The following code works in Firefox but not Chrome. In Chrome, the checkbox returns True when unchecked and False when checked. I'm using GXT 3.1.

    Code:
    public void onModuleLoad() {   
         RootLayoutPanel.get().add(TestCheckBox());
    }
        
     private Widget TestCheckBox() {
              
           final CheckBox cb = new CheckBox();
           cb.setValue(true);
           final TextField tf = new TextField();
              
           cb.addChangeHandler(new ChangeHandler(){
    
    
                @Override
                public void onChange(ChangeEvent event) {
                    boolean checked = ((CheckBox) event.getSource()).getValue();
                    GWT.log("before- input enabled: "+tf.isEnabled()+", checked: "+checked);
                    tf.setEnabled(checked);
                    GWT.log("after- input enabled: "+tf.isEnabled()+", checked: "+checked);
                }
                  
           });
              
           FlowLayoutContainer con = new FlowLayoutContainer();
           con.add(cb);
           con.add(tf);
           return con;
    }

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223

    Default

    I guess using Changehandler on a checkbox is not a good idea. If I recall correctly, I had some issues with it. Clicking the Label for toggling is one of them.

    Try ValueChangeHandler. I think, it will fix your problem.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    18

    Default

    Thanks Andreas! That work perfect!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •