ember.js - Emberjs get multiple checkbox attributes on change -


i have multiples inputs checkbox , want know when @ least 1 of them change attribute "checked" , enable button "sim".

<div id="alertreject{{post.id}}" style="display: none;">   você deseja rejeitar resposta #id {{post.id}}? porque?   <hr style="margin: 5px 0;">   <div class="checkbox">     <label>{{input type="checkbox"}} ofensas</label>     <label>{{input type="checkbox"}} discussão agressiva entre os participantes</label>     <label>{{input type="checkbox"}} discussão pessoalizada</label>     <label>{{input type="checkbox"}} postagens que fogem ao tema</label>     <label>{{input type="checkbox"}} questionamentos sobre metodologia</label>     <label>{{input type="checkbox"}} questionamentos sobre definição de conceitos</label>     <label>{{input type="checkbox"}} participante se volta contra o moderador</label>   </div>   <hr style="margin: 5px 0;">   <div class="form-group">     <label>mensagem adicional: <b>(opcional)</b></label>     <textarea name="{{post.id}}-msgopt"></textarea>   </div>   <button class="btn btn-danger" disabled="disabled" {{action 'rejectpost' post}}>sim</button> |   <button class="btn btn-default" {{action 'dismisspopover'}}>não</button> </div> 

i've been tried components, views, actions , can't checkbox's change event.

what best way this?

ps.: 1 important thing note structure inside loop.

given

{{input type="checkbox" checked=foo}} {{input type="checkbox" checked=bar}} {{input type="checkbox" checked=baz}} 

add computed property template's context that's true if 1 or more of values checked

hasresponded: ember.computed.or('foo', 'bar', 'baz') 

then bind disabled class on submit button:

<button {{action 'rejectpost' post}}   {{bind-attr class="hasresponded::disabled :btn :btn-danger"}}>   sim </button> 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -