假设我有四个字段,例如帐户 组合一: 组合二: 我已经尝试过if语句,但是无法获得正确的结果。
这是我的代码。 }; id
,pin
和pin_id
。为了提交表单,它需要满足此组合,如果提交表单时它们为空,则必须在字段下方显示错误消息。if "account" AND "id" fields
是empty
,则需要"pin" OR "pin_id"
字段来提交请求。if "pin" AND "pin_id" fields
是empty
,将需要"account" OR "id"
字段来提交请求。 if (pin.value == "" && pin_id.value == "") {
appendError(account, errorMessage);
appendError(id, errorMessage);
if (account.value != "" || id.value != "") {
removeErrorMessage(account);
removeErrorMessage(id);
}
return true;
}
if (account.value == "" && id.value == "") {
appendError(pin, errorMessage);
appendError(pin_id);
if (pin.value != "" || pin_id.value != "") {
removeErrorMessage(pin);
removeErrorMessage(pin_id);
}
return true;
}
return false;
0 个答案:
没有答案