Click here to Skip to main content
11,636,260 members (83,759 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery validation struts Client , +
Hi,Below is the code I am using to submit a form the problem is that I am not able to apply the jquery client validation..Please help me with the necessary jquery to do the same ..thanks in advance
$(document).ready(function(){
 
     $.subscribe('validateFields', function(event,data) {
$("#formId").validate();
 
});
});         
<s:form name="add" method="post" id="formId" theme="simple">
<s:textfield name="server.title" cssClass="input_text_lrg required" id="Title"/>
<s:textfield name="server.name" cssClass="input_text required" id="Name"/>
<s:url id="SAVE_ADD" action="save" namespace="/"/>
<sj:submit name="submit" value="Save" cssClass="input_button" labelposition="left" href="%{SAVE_ADD}" targets="results" onBeforeTopics="validateFields="/>
</s:form>
Posted 23-Jul-12 2:36am
Edited 24-Jul-12 2:21am
v7
Comments
ryanb31 at 23-Jul-12 10:22am
   
What is a sj:submit and what is the actual problem?
riyasn at 24-Jul-12 0:46am
   
its just a button(struts jquery button) to submit the form..My problem is that when i click the button with out adding any data in the fields i need to show the error as to enter the data in the fields
ryanb31 at 24-Jul-12 7:50am
   
Doesn't it support the onclick event? Just create an onclick event and do all of the validation you need.
riyasn at 24-Jul-12 8:20am
   
I have edited the quwstion as the way I tried to do please check and tell me whats wrong in it it is giving an error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 jyo.net 333
1 OriginalGriff 283
2 Sergey Alexandrovich Kryukov 255
3 Suvendu Shekhar Giri 225
4 Mika Wendelius 204
0 OriginalGriff 8,941
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,364
4 Suvendu Shekhar Giri 2,320


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 24 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100