1
私は、フォーム上で検証を実行するためにAbideを使用していますが、正常に動作しています。しかし、フォームが有効であるか無効である場合、私はアクションを実行するのが難しいです。Foundationを起動する - valid.fndtn.abideを起動する
HTML:
<form role="form" id="form_search_extended" name="form_search_extended" data-abide="ajax" novalidate>
<input name="postalCode" type="text" value="{{$data['postalCode']['value']}}" placeholder="ZIP/Postal Code" required maxlength="10">
<button type="submit" value="Submit">Submit</button>
</form>
のJavascript:有効または無効リスナー内部
$('#form_search_extended')
.on('invalid.fndtn.abide', function() {
callFunctionOnValid();
console.log('invalid!');
})
.on('valid.fndtn.abide', function() {
console.log('valid!');
});
var form = document.getElementById('form_search_extended');
form.onsubmit = function(e) {
e.preventDefault();
console.log('form submitted');
};
コードが実行されませんでした。
なぜこれが機能しないのかわかりません。 valid.fndtn.abideのイベントリスナーが起動されていませんか?フィールドの検証が表示されているため、Abideは機能しています。
ありがとうございました。