File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Client Side Custom Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Client Side Custom Validation" Watch "Client Side Custom Validation" New topic

Client Side Custom Validation

dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
I am having a form with some text fields. I am using predefined as well as my custom validations on this form.
I need the client side java script validations. So, I am using...

<html-el:messages id="msg" message="true"><li><font color="red"><c ut value="${msg}"/></font></li></html-el:messages>
<html-el:errors />
<html-el:form action="ItemTypeCRUD" onsubmit="return validateItemTypeCRUDForm(this);">

<html-el:javascript formName="ItemTypeCRUDForm"/>


Now, The problem is that all the predefined validations like "required,mask" are displayed as an "Alert" as is the case in javascript(Which I want). But my custom validations are getting printed on
the screen.
What should i do to display my custom validations as an "Alert".

Thanks in Advance.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I do not use client side validations, but my understanding is that you would have to write JavaScript code to implement your custom validation rule and add that JavaScript to your validator-rules.xml file. Have you done this?

- Brent
dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
Yes I have done this and my customize validation is working fine. The only problem is that it is printing message on the screen. But I want it to be appeared as an alert as is the case of normal javascript.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Client Side Custom Validation
jQuery in Action, 3rd edition