{"action":"closed","issue":{"url":"https://api.github.com/repos/1000hz/bootstrap-validator/issues/143","labels_url":"https://api.github.com/repos/1000hz/bootstrap-validator/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/1000hz/bootstrap-validator/issues/143/comments","events_url":"https://api.github.com/repos/1000hz/bootstrap-validator/issues/143/events","html_url":"https://github.com/1000hz/bootstrap-validator/issues/143","id":85768700,"number":143,"title":"isDefaultPrevented is always false ","user":{"login":"derekang","id":889647,"avatar_url":"https://avatars.githubusercontent.com/u/889647?v=3","gravatar_id":"","url":"https://api.github.com/users/derekang","html_url":"https://github.com/derekang","followers_url":"https://api.github.com/users/derekang/followers","following_url":"https://api.github.com/users/derekang/following{/other_user}","gists_url":"https://api.github.com/users/derekang/gists{/gist_id}","starred_url":"https://api.github.com/users/derekang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekang/subscriptions","organizations_url":"https://api.github.com/users/derekang/orgs","repos_url":"https://api.github.com/users/derekang/repos","events_url":"https://api.github.com/users/derekang/events{/privacy}","received_events_url":"https://api.github.com/users/derekang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-06T15:21:34Z","updated_at":"2015-06-10T05:30:17Z","closed_at":"2015-06-10T05:30:17Z","body":"Hi, \r\n\r\nI am integrating bootstrap validator with React. I am at the stage where i want to detect if the form is valid or invalid. I realized that isDefaultPrevent() always return false. (Even when the form is not validated).\r\n\r\nCheck out the handleSave function.\r\n\r\nBelow is my code snippet.\r\n\r\n\r\n    var SettingsForm = React.createClass({\r\n\tgetInitialState: function() {\r\n        return {\r\n            data: []\r\n        };\r\n    },\r\n    componentDidMount: function() {\r\n        $(React.findDOMNode(this)).validator();\r\n        $.getJSON(this.props.settingsDataUrl, function(result) {\r\n            if (this.isMounted()) {\r\n                React.findDOMNode(this.refs.email).defaultValue = result.User.email;\r\n                React.findDOMNode(this.refs.firstname).defaultValue = result.User.firstname;\r\n                React.findDOMNode(this.refs.lastname).defaultValue = result.User.lastname;\r\n                React.findDOMNode(this.refs.companyname).defaultValue = result.User.companyname;\r\n\r\n            }\r\n        }.bind(this));\r\n    },\r\n    handleSave: function(e) {\r\n        \r\n        var email = React.findDOMNode(this.refs.email).value.trim();\r\n        var firstname = React.findDOMNode(this.refs.firstname).value.trim();\r\n        var lastname = React.findDOMNode(this.refs.lastname).value.trim();\r\n        var companyname = React.findDOMNode(this.refs.companyname).value.trim();\r\n        var newpassword = React.findDOMNode(this.refs.newpassword).value.trim();\r\n        var confirmnewpassword = React.findDOMNode(this.refs.confirmnewpassword).value.trim();\r\n\r\n        console.log(e.isDefaultPrevented());\r\n        e.preventDefault();\r\n        if (!email || !firstname || !lastname || !companyname) {\r\n            return;\r\n        }\r\n        this.props.onSettingsSave({\r\n            email: email,\r\n            firstname: firstname,\r\n            lastname: lastname,\r\n            companyname: companyname,\r\n            newpassword: newpassword,\r\n            confirmnewpassword: confirmnewpassword\r\n        });\r\n        return;\r\n    },\r\n\trender: function() {\r\n\t\treturn (\r\n\t\t\t<form className=\"settingsForm\" onSubmit={this.handleSave}>\r\n\t\t\t\t<div className=\"col-md-6\">\r\n\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t<label className=\"control-label\">Email Address</label>\r\n\t\t\t\t\t\t<input type=\"email\" className=\"form-control input-sm\" placeholder=\"Email Address\" defaultValue={this.state.data.email} ref=\"email\" required disabled />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"col-md-6 pz\">\r\n\t\t\t\t\t\t<div className=\"form-group col-md-11 pz\">\r\n\t\t\t\t\t\t\t<label className=\"control-label\">First Name</label>\r\n\t\t\t\t\t\t\t<input type=\"text\" className=\"form-control input-sm\" placeholder=\"First Name\" ref=\"firstname\" required />\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"col-md-6 pz\">\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label className=\"control-label\">Last Name</label>\r\n\t\t\t\t\t\t\t<input type=\"text\" className=\"form-control input-sm\" placeholder=\"Last Name\" ref=\"lastname\" required />\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t<label className=\"control-label\">Company Name</label>\r\n\t\t\t\t\t\t<input type=\"text\" className=\"form-control input-sm\" placeholder=\"Company Name\" ref=\"companyname\" required />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t<label className=\"control-label\">Change Password</label>\r\n\t\t\t\t\t\t<input type=\"password\" className=\"form-control input-sm\" id=\"newpassword\" ref=\"newpassword\" placeholder=\"New Password\" data-minlength=\"6\"/>\r\n\t\t\t\t\t\t<span className=\"help-block\">Minimum of 6 characters</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t<input type=\"password\" className=\"form-control input-sm\" ref=\"confirmnewpassword\" placeholder=\"Confirm New Password\" data-match=\"#newpassword\" data-match-error=\"Your password does not match. Please try again.\" />\r\n\t\t\t\t\t\t<div className=\"help-block with-errors\"></div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<br/>\r\n\t\t\t\t\t<hr/>\r\n\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t<input type=\"submit\" className=\"btn btn-sm btn-primary\" value=\"Save\" />\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\t\t\t\t<div className=\"col-md-6\">\r\n\t\t\t\t</div>\r\n\t\t\t</form>\r\n\t\t);\r\n\t}\r\n    });\r\n"}}