これ以下のように、Web メールフォームに 4 つのドロップダウンがあります
<select name="newstaff" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="allstaff" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="learning" class="formStyle" style="width:400px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="leaders" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
ユーザーが少なくとも 1 つのドロップダウンから他のオプションを 1 つも選択せずにこのフォームを送信しようとした場合にアラートを表示する検証関数を作成するにはどうすればよいでしょうか。
ありがとう
編集:
フォームの検証に使用されるコード:
function validateForm(objForm)
{
var returnStatus = 1;
if (objForm.newstaff.selectedIndex == 0) {
alert("please make a selection!");
returnStatus = 0;
};
if (returnStatus) {
objForm.submit();
}
}