2010-11-24 53 views
0

我正在爲創建的Flash表單進行簡單驗證。它與文本提交和無線電組合正常工作。但與ComboBox有問題。任何人都可以幫忙嗎?提前致謝。Flash表單驗證:組合框驗證:AS3:Flash CS3

是否可以寫成,

}否則,如果(placeopCombo.selected!){ status_txt.text = 「請選擇購買地點」;


我的代碼如下

如果(nameTxt.length!){ status_txt.text = 「請輸入您的姓名」; (!emailTxt.length){ status_txt.text =「請輸入你的電子郵件」; } else if(!mobileTxt.length){ status_txt.text =「請輸入您的手機號碼」;

}其他{

//做了提交

回答

0

將selectedItem屬性爲null,直到你選擇的東西,所以你應該能夠做到這一點:

} else if (!placeopCombo.selectedItem) { status_txt.text = "Please choose Place of Purchase"; 

Aternatively可以檢查索引或標籤是否與初始/默認值不同

} else if (placeopCombo.selectedIndex != defaultIndex) { status_txt.text = "Please choose Place of 

不知道這個階段是否方便,還可以看看Yahoo! Form components

+0

嗨喬治,謝謝你的回覆。但我認爲,ComboBox.selectedItem將保持默認的選定值。我只是打印該值來確認。它返回組合框中的第一個值。無論如何感謝雅虎FDN .. – sr77in 2010-11-24 14:01:56