-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
FormControllerのmessageプラグインを使った時にFormController.validate()を呼んで、結果がvalidである場合にエラーが出ます。
以下再現コード
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<link href="/lib/hifive/1.2.2/h5.css" rel="stylesheet">
<script src="/lib/hifive/1.2.2/ejs-h5mod.js"></script>
<script src="/lib/hifive/1.2.2/h5.dev.js"></script>
<script>
$(function() {
var $form = $('<form><input type="text" name="hoge" value="abc"></form>');
$(document.body).append($form);
var c = h5.core.controller($form, h5.ui.FormController);
c.readyPromise.done(function() {
c.addOutput(['message']);
c.addRule({
hoge: {
required: true
}
});
c.validate(); // エラー
// invalidな値の場合はエラーにならない(以下はエラーにならない)
// this.$find('[name=hoge]').val('');
// c.validate();
});
});
</script>
</head>
<body>
</body>
</html>以下コンソールログ
[DEBUG]11:9:34,130: local storage supported:true, session storage supported:true
h5.dev.js:2986 [INFO]11:9:34,132: 開発版のhifive(ver.1.2.2)の読み込みが完了しました。リリース時はMinify版(h5.js)を使用してください。
h5.dev.js:2986 [INFO]11:9:34,132: hifive内部で使用されるjQueryのバージョン:2.1.1
h5.dev.js:2989 [DEBUG]11:9:34,136: コントローラ"h5.ui.FormController"の初期化を開始しました。
h5.dev.js:2986 [INFO]11:9:34,216: コントローラ"h5.ui.FormController"の初期化が正常に完了しました。
h5.dev.js:2989 [DEBUG]11:9:34,217: コントローラ"h5.ui.validation.Message"の初期化を開始しました。
h5.dev.js:2989 [DEBUG]11:9:34,218: コントローラ"h5.ui.validation.MessageOutputController"の初期化を開始しました。
h5.dev.js:2989 [DEBUG]11:9:34,222: -----------------------------------------
h5.dev.js:2989 [DEBUG]11:9:34,222: ・validateするデータ
h5.dev.js:3047 [DEBUG]11:9:34,223: Object {hoge: "abc"}
h5.dev.js:2989 [DEBUG]11:9:34,225: ・validate対象のプロパティ:undefined
h5.dev.js:2989 [DEBUG]11:9:34,225: ・validate結果
h5.dev.js:3047 [DEBUG]11:9:34,225: ValidationResult {isValid: true, validProperties: Array[1], invalidProperties: Array[0], validatingProperties: Array[0], invalidReason: null…}
h5.dev.js:2989 [DEBUG]11:9:34,226: 同期
h5.dev.js:2989 [DEBUG]11:9:34,226: -----------------------------------------
h5.dev.js:22449 Uncaught TypeError: Cannot read property 'hoge' of null
Reactions are currently unavailable