1

checkbox event:

<input type="checkbox" name="contents" value="1" {{action 'enable_submit'}} /> 

submit button

<button id='submit_btn' class='btn' disabled="disabled">Submit</button>

when user click checkbox, remove disabled of submit button

$("#submit_btn").removeAttr('disabled')

The result is:

1, disable status of submit button can be removed normally.

2, the checkbox can't be checked again, it is the same problem on radiobutton

1
  • was my answer what you where looking for? let me know if it helped Commented Jul 9, 2013 at 13:18

1 Answer 1

1

Have a look at this jsbin for a possible implementation.

Basically every time the checked status of the checkbox changes it triggers the disabled status of the button. This is possible due to the two-way binding ember.js provides for you.

Here the view:

App.IndexView = Ember.View.extend({
  disabled: false
});

The checkbox:

{{view Ember.Checkbox checkedBinding="view.disabled"}}

The button:

{{#view Ember.Button class='btn btn-warning' disabledBinding="view.disabled"}}Submit{{/view}}

This binding behavior can also be defined somewhere else, I've put it on the view for the sake of simplicity.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.