• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation of Html options

 
Luke Zechariah
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me of how to validate html ptions? This is my code



What should I put in validation.xml and validation-rules.xml files if I need validate the field for "required"

Thanks in advance.

Lk.
 
sureshreddy puli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following.

<html:select property="category" style="width:155px" tabindex="12">
1opt<html ption value="" >- - - -Select- - - - </html ption>2opt<html ption value="...">...</html ption>
3opt<html ption value="...">...</html ption>
4opt<html ption value="...">...</html ption>
5opt<html ption value="...">...</html ption>
</html:select>

Observe the above code.Don't provide the value to 1opt(first option).It'll work fine.

Regards
Suri.
 
sureshreddy puli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Modify your code as the following.

 
Luke Zechariah
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sureshreddy,

Thanks for the reply. But still I am getting the following error, if we validate html ptions. I have searched the complete forum and so many of my friends had the same error and looks like none got the answer for this.

Following is the error:



 
Luke Zechariah
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Just now found out the answer of how to validate html ptions when we get the error "Cannot find bean under name clmTypeList"

Make an Actionform class "Testng1" where the ArrayList is populated.



In the Action Class put


In the jsp file file put


It should work.

Thanks,
Lk.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic