EasyUI Forum
September 13, 2025, 09:57:38 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Validation of a combobox  (Read 13562 times)
sm_79
Newbie
*
Posts: 4


View Profile
« on: August 15, 2014, 03:19:07 PM »

Hi,
I have a form with a simple combo box like below:
Code:
<select class="easyui-combobox" data-options="required:true" name="type">
<option value="" selected="selected">Select Type</option>
<option value="0">Initial Assessment</option>
<option value="1">Pre-Test</option>
<option value="2">Assessment</option>
</select>
I want this combobox to be validated so that user must select one of the 3 options. I have added data-options="required:true" attribute but the validation does not work. However, if I remove the text value "Select Type" from the first <option> then the validation is happening.

But I want to keep the "Select Type" text and also the validation to work. Please advise. Thank you.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 15, 2014, 04:00:29 PM »

Why append the 'Select Type' item? If you only want to give the user a tip, please set the 'prompt' property instead.
Code:
<select class="easyui-combobox" data-options="required:true,prompt:'Select Type',value:''" name="type">
<option value="0">Initial Assessment</option>
<option value="1">Pre-Test</option>
<option value="2">Assessment</option>
</select>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!