すでに入力されているフォームフィールドがあり、送信ボタンを押した場合、検証は行われませんが、フィールドに変更を加えた場合(1文字またはtwo0を追加する場合など)、検証が行われます。 ...。
<form id="form_state_edit" method="post" action="javascript:void(0);">
<fieldset class="fieldset">
<legend class="legend">Add a new State</legend>
<div id="form-wrapper-state-modal" style="width: 20rem;margin-left:5rem;margin-bottom:0.5rem;margin-top:-14px;"></div>
<div style="">
<p class="button-height inline-label">
<label class="label" for="state_name" style="display:inline;">State Name</label>
<input type="text" value="<?=$state_name?>" class="input validate[required,custom[onlyLetterSp]]" id="state_name" name="state_name" style="width: 15rem;" />
<input type="hidden" value="<?=$state_arr[1]?>" id="state_id" name="state_id" />
<input type="hidden" value="edit" id="state_action" name="state_action" />
<button id="submit_state" class="button glossy mid-margin-right" type="submit">
<span class="button-icon">
<span class="icon-tick"></span>
</span>
Save
</button>
<div id="state_table_temp" style="display:none;"></div>
</p></div>
</fieldset>
</form>
$("#form_state_edit").validationEngine('attach', {
onSuccess: function(form, status){
alert("The form status is: " +status+", it will never submit");
} ,
onValidationComplete: function(form, status){
alert("The form status is: " +status+", it will never submit");
}
基本的に-変更がない場合(フォームフィールドをクリックして何も入力しない場合など)-onValidationCompleteが実行され、status = true
私が変更を行う場合-onSuccessは実行されます...
その人がフォームフィールドに変更を加えていない(またはフォームフィールドをクリックしていない)場合でも、検証を実行して成功部分に進むように、何を書く必要がありますか...
検証を開始する前に、提出されたofrを「アクティブ化」する必要があるようです。
\何か案が ?