Click here to Skip to main content
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 Sergey Alexandrovich Kryukov 511
1 OriginalGriff 344
2 DamithSL 235
3 Maciej Los 140
4 Bruno Sprecher 130
0 DamithSL 185
1 OriginalGriff 105
2 Peter Leow 60
3 Maciej Los 50
4 abhijeetgupta1988 45


Advertise | Privacy | Mobile
Web02 | 2.8.141030.1 | Last Updated 24 Jul 2012
Copyright © CodeProject, 1999-2014
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