tdog tdog - 2 years ago 129
HTML Question

Using Meteor with input of checkbox

Hello I have having a problem with my checkbox's staying checked when I check them. So what I want to be able to do is check and uncheck as I click the box. But once I check it it is stuck with a check and I can no longer do anything to it. Here is the relevant code!

import React, {Component} from 'react';

export default class ResolutionSingle extends Component {

toggleChecked() {'toggleResolution', this.props.resolution._id, this.props.resolution.copmlete);

deleteResolution() {'deleteResolution', this.props.resolution._id);

render() {
return (
<input type="checkbox"
onClick={this.toggleChecked.bind(this)} />
<button className="btn-cancel"

Here are the methods

addResolution(resolution) {
text: resolution,
complete: false,
createAt: new Date()
toggleResolution(id, status) {
Resolutions.update(id, {
$set: {complete: !status}
deleteResolution(id) {

Here is the main wrapper

import React from 'react';
import ReactDOM from 'react-dom';
import TrackerReact from 'meteor/ultimatejs:tracker-react';

import ResolutionsForm from './ResolutionsForm.jsx';
import ResolutionSingle from './ResolutionSingle.jsx';

Resolutions = new Mongo.Collection("resolutions");

export default class ResolutionsWrapper extends TrackerReact(React.Component) {

this.state = {
subscription: {
resolutions: Meteor.subscribe("allResolutions")

componentWillUnmount() {

resolutions() {
return Resolutions.find().fetch();

return (
<h1>My Resolutions</h1>
<ResolutionsForm />
<ul className="resolutions">
{this.resolutions().map( (resolution)=>{
return <ResolutionSingle key={resolution._id} resolution={resolution} />

Answer Source

You have a typo in your code.'toggleResolution', this.props.resolution._id, this.props.resolution.copmlete);

It should be complete instead of copmlete. In order to avoid errors like that in the future, you can use check functions in your Meteor methods.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download