Hybrid View

  1. #1
    Sencha User drumforhim's Avatar
    Join Date
    May 2011
    Location
    Greece
    Posts
    14
    Vote Rating
    0
    drumforhim is on a distinguished road

      0  

    Default Unanswered: Click event on checkbox

    Unanswered: 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
    411
    Vote Rating
    21
    Answers
    20
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    use CheckBox.addChangeHandler(...)

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Answers
    109
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      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
    411
    Vote Rating
    21
    Answers
    20
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


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

Thread Participants: 2