Results 1 to 4 of 4

Thread: Click event on checkbox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User drumforhim's Avatar
    Join Date
    May 2011
    Location
    Greece
    Posts
    14
    Vote Rating
    0
      0  

    Default Click event on checkbox

    Hello everyone
    Can please someone explain to me how can i add a click event on a checkbox in my form. i have tried check,change,handler but they all seem to fire when the form loads, something that i don't want to. i simply want to alert the user with a message when he clicks on the checkbox.
    Thank you

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20
    Vote Rating
    21
      0  

    Default

    use CheckBox.addChangeHandler(...)

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      0  

    Default

    I'd actually suggest CheckBox.addValueChangeHandler. This will give you several kinds of changes:

    o Any toggle of the checkbox (click or space bar)
    o Any click on the label to the right of the checkbox (This text is set via CheckBox.setBoxLabel)
    o Any invocation of CheckBox.setValue(newValue, true) - the second parameter set to true means 'fire a valuechangeevent'.

    ChangeEvent won't go off in the second two cases, ClickEvent won't go off in at least the last case and perhaps more.

    ChangeEvent and ClickEvent are the DOM events themselves, while ValueChangeHandler is a logical event, sent by the widget, only in cases that make sense.

    As far as firing when the page loads, take a look at http://www.sencha.com/examples/#Exam...e:formsexample - this has ValueChangeHandlers set on the CheckBoxes, but they dont go off when the basic values are set.

  4. #4
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20
    Vote Rating
    21
      0  

    Default

    gah! i keep forgetting about that one - one of these days you'd think i would remember.

Posting Permissions

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