我有一个网站,允许用户创建结算周期,我希望如此,如果他们点击复选框,则下拉列表必须等于或大于1.这是复选框的代码和下拉列表的代码。
<tr>
<td>Set As A Recurring Fee Every (leave blank for a one-time charge)<br/>
<select name="FrequencyDuration" style="width:50px; background: url('images/subfield_50.png') no-repeat scroll 0 0 transparent;">
<option value=""></option>
<cfloop from="1" to="60" step="1" index="i">
<option value="#i#">#i#</option>
</cfloop>
<cfif #session.cid# eq '15351' or #session.pid# eq 'f39ec354'><option value="1" SELECTED>1</option></cfif>
</select>
<select name="FrequencyUnit" style="width:100px; background:url('images/subfield_100.png') no-repeat scroll 0 0 transparent;">
<option value="d">Day(s)</option>
<option value="ww">Week(s)</option>
<option value="m">Month(s)</option>
<option value="q">Quarter(s)</option>
<option value="yyyy">Year(s)</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right">
<span style="position:relative; top:10px;">Do Not Submit Fee; Only Establish Recurring Fee
<input type="Checkbox" name=" Only" value="1">
</span>
<input class="standardButtonRight button" id="submitFeesbtn" type="submit" value="Submit Fee" style="border:0px;"></input>
</td>
</tr>
</table>
</form>
</cfoutput>
</div>
现在,这里是表单验证的地方:
//Form Validation
$('#submitFees').validate({
wrapper: "span",
position: "bottom",
messageClass: "error",
debug:true
});
var frm = $('#submitFees');
$('#submitFeesbtn').click(function(){
if($('#submitFees').valid()) {
$.ajax({
type: frm.attr('method'),
url: frm.attr('action'),
data: frm.serialize(),
success: function (data) {
$('div#clientFees').html(data).hide().fadeIn(500);
}
});
}
return false;
});
这是否有效,我无法弄清楚如何实现它。
if($("# Only").prop('checked')){
return true;
} else {
alert('Please set the recuuring fee');
}