我遇到了一个由两部分组成的动态Web表单的麻烦。我试图简单地允许在表单的第二部分存在或出现“ .order-option
”
我已经修改为在display block;
条件下尝试换行。然后尝试合并设置的超时时间以连续检查是否每个500
。
当前,通过这种尝试,当第二种形式不存在'.order-option
'时,这些错误验证将不会发生,但是,当第二种形式出现时,相关的验证将根本无法进行。
function ValidateIfExists(){
if($(".order-option").css("display")=="block"){
$("#Form-form").form({
fields: {
firstName: {
identifier: 'fields[firstName]',
rules: [{ type: 'empty', prompt: 'Please enter your first name' }]
},
lastName: {
identifier: 'fields[lastName]',
rules: [{ type: 'empty', prompt: 'Please enter your last name' }]
},
email: {
identifier: 'fields[email]',
rules: [{ type: 'email', prompt: 'Please enter a real email address' }]
},
gender: {
identifier: 'fields[genderIdentity]',
rules: [{ type: 'checked', prompt: 'Please select your gender identity' }]
},
sexuality: {
identifier: 'fields[sexuality]',
rules: [{ type: 'empty', prompt: 'Please select your sexuality' }]
},
ethnicity: {
identifier: 'fields[ethnicity]',
rules: [{ type: 'empty', prompt: 'Please select your ethnicity' }]
},
age: {
identifier: 'fields[age]',
rules: [{ type: 'ageCheck[16]', prompt: 'You must be 16 or over' }]
},
//unitNumber: {
// identifier: 'fields[unitNumber]',
// rules: [{ type: 'empty', prompt: 'Address unit number is needed' }]
//},
streetAddress: {
identifier: 'fields[streetAddress]',
rules: [{ type: 'empty', prompt: 'Street address is needed' }]
},
suburb: {
identifier: 'fields[suburb]',
rules: [{ type: 'empty', prompt: 'Suburb is needed' }]
},
city: {
identifier: 'fields[city]',
rules: [{ type: 'empty', prompt: 'City is needed' }]
},
postalCode: {
identifier: 'fields[postalCode]',
rules: [{ type: 'empty', prompt: 'Post code is needed' }]
},
addressConfirmed: {
identifier: 'fields[addressConfirmed]',
rules: [{ type: 'checked', prompt: 'Please double check and confirm your address' }]
},
isPersonalOrder: {
identifier: 'fields[isPersonalOrder]',
rules: [{ type: 'checked', prompt: 'You need to acknowledge this order is for you' }]
}
}
});
}
}