File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Validation of Html options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation of Html options" Watch "Validation of Html options" New topic
Author

Validation of Html options

Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 117
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

Joined: Sep 28, 2005
Posts: 29
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

Joined: Sep 28, 2005
Posts: 29


Modify your code as the following.

Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 117
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

Joined: Sep 27, 2005
Posts: 117
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation of Html options
 
Similar Threads
Struts help
How to retrieve property and labelProperty info from action class
with html : options tag
html: options collection in Struts
Select problem