我正在使用AngularJs。我有一個下拉列表,我想通過點擊提交按鈕進行驗證。下拉定義如下:使用Angular Js進行下拉驗證
<select name="userTypeSelect" ng-model="selecteduserType" ng-options="user.UserTypeName for user in users" ng-change="updateImageUrl(selectedUserType)">
<option value="">-- Select the User --</option>
</select>
按鈕被定義爲下面的提交:
<input type="submit" value="Submit" ng-click="add()" />
選項-- Select the User -
在下拉列表中可用的第一個選項。我想檢查用戶是否沒有選擇任何東西或選擇-- Select the User --
,我想在點擊提交按鈕時顯示驗證。
如何檢查下拉列表是否有正確的數據,當用戶點擊提交按鈕時不爲空。
HI ..在indexxhange上,是否可以隱藏錯誤消息,並且僅當點擊提交按鈕時才顯示 – venkat14
@ venkat14它正在處理僅提交..on indexxhange錯誤消息已隱藏。 –
嗨。 indexchange錯誤消息變得可見。場景:初始消息被隱藏。選擇服務並點擊提交。顯示消息。現在選擇一個有效的數據。再次選擇「選擇服務」,顯示錯誤信息 – venkat14