Click here to Skip to main content
12,292,047 members (76,599 online)
Rate this:
 
Please Sign up or sign in to vote.
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 23-Jul-12 10:22am
   
What is a sj:submit and what is the actual problem?
riyasn 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 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 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
Top Experts
Last 24hrsThis month


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