そのため、4 つの部分があり、異なるページに分割されている JQM フォームを検証しようとしています。フォームが有効であれば、最初の部分を検証した後、2 番目の部分に進みたいと思います。JQuery.validate プラグインで検証しようとしていますが、フォームにまったく応答しません。
PS:JQuery.validation プラグインを使用する必要があります
<div data-role="page" id="page2" data-add-back-btn="true">
<div data-role="header" data-position="fixed">
<h1 id="page2Header"></h1>
</div>
<div data-role="content">
<form id="sampleProperties">
<label for="station">Select Station:</label>
<select name="station" id="station" onBlur="storeData(this.id,this.value)" required="true">
<option value="50028000">Tanama River</option>
<option value="50010500">Rio Guajataca, Lares</option>
<option value="60008002">Example River2</option>
<option value="60008003">Example River3</option>
<option value="60008004">Example River4</option>
</select>
<div class="hide">
<div class='suspendedAdditionalFields'>
<label for="sampleMediumDropdown">Select sample medium:</label>
<select name="sampleMediumDropdown" id="sampleMediumDropdown" onBlur="storeData(this.name,this.value)">
<option value="WS">WS(Surface Water)</option>
<option value="WSQ">WSQ(Surface Water QC)</option>
</select>
</div>
<div class='bottomAdditionalFields'>
<label for="sampleMediumDropdownBottom">Select sample medium</label>
<select name="sampleMediumDropdown" id="sampleMediumDropdownBottom" onBlur="storeData(this.name,this.value)">
<option value="SB">SB (bottom material)</option>
<option value="SBQ">SBQ (bottom material QC)</option>
</select>
</div>
</div>
<label for="date">Begin Date:</label>
<input name="date" id="beginDate" type="date" onChange="storeData(this.id,this.value)" />
<div class="hide">
<label for='EVENT'>Hydrologic event:</label>
<select name="EVENT" id="EVENT" onBlur="storeData(this.name,this.value)">
<option value="1">1- Drought</option>
<option value="2">2- Spill</option>
<option value="3">3- Regulated Flow</option>
<option value="4">4- Snowmelt</option>
<option value="5">5- Earthquake</option>
<option value="6">6- Hurricane</option>
<option value="7">7- Flood</option>
<option value="8">8- Volcanic activity</option>
<option value="9" selected>9- Routine Sample</option>
<option value="A">A- Spring breakup</option>
<option value="B">B- Under ice cover</option>
<option value="C">C- Glacial lake outbreak</option>
<option value="D">D- Mudflow</option>
<option value="E">E- Tidal action</option>
<option value="F">F- Fire, affected by fire prior sampling</option>
<option value="H">H- Dambreak</option>
<option value="J">J- Storm</option>
<option value="K">K- Backwater</option>
<option value="X">X- Not applicable</option>
</select>
</div>
<div class="ui-grid-a">
<label for="containerCuantity">Add a group of single container or sets of multiple samples: </label>
<div class="ui-block-a">
<input type="number" min="1" value="1" max="40" id="containerCuantity" name="containerCuantity" onBlur="storeData(this.id,this.value)"/></div>
<div class="ui-block-b">
<select id="singleMultiContainer" name="singleMultiContainer" onChange="storeData(this.id,this.value)">
<option value="" selected>--Select Container or Set--</option>
<option value="single">Single container sample</option>
<option value="multi">Multiple sets container</option>
</select>
</div>
</div>
<input id='addSampleParameters'type="submit" value="Next"/>
</form>
</div>
<div data-role="footer" data-position="fixed">
<div data-inline="true" data-type="horizontal"><a href="#" data-icon="bars" data-iconpos="notext" data-inline="true" data-mini="false" data-role="button">Menu</a><a id="addSampleParameters" data-icon="arrow-r" data-iconpos="right" data-inline="true" data-role="button" data-mini="false" data-theme="e">Next</a>
</div>
</div>
</div>
js:
$('#page2').bind('pageinit',function(){
$('#sampleProperties').validate({
rules:{
station: 'required',
date: 'required',
singleMultiContainer: 'required',
containerCuantity:{
required:'true',
minlength:1,
maxlength:40
}
},
submitHandler: function(form) {
alert('Success!');
}
});
});