jQuery Validation: If one input is entered, others should become mandatory -
i have form several lines of 4 input fields, looks this:
<tr> <td><input name="company01" id="company01" /></td> <td><input name="description01" id="description01" /></td> <td><input name="costs01" id="costs01" class="sum" /></td> <td><input name="file01" id="file01" /></td> </tr> <tr> <td><input name="company02" id="company02" /></td> <td><input name="description02" id="description02" /></td> <td><input name="costs02" class="sum" id="costs02" /></td> <td><input name="file02" id="file02" /></td> </tr>
now, when user enters 1 of inputs of row (for illustration costs field), should mandatory come in company , descripton (but not attachment).
file-upload never mandatory. however, user has finish @ to the lowest degree on row company, description , costs.
could tell me how can check if @ to the lowest degree 1 row has been completed? , how go checking if other 2 have been completed using jquery validation plugin?
can done required method , dependency expressions
.... rules : { company01 : { required : "#company02:blank" }, description01 : { required : "#company01:filled" }, costs01: { required : "#company01:filled" }, // company 2 company02 : { required : "#company01:blank" }, description02 : { required : "#company02:filled" }, costs02: { required : "#company02:filled" } } ....
jquery jquery-validate
No comments:
Post a Comment