Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
PHP
$(document).ready(function(){

     $.subscribe('validateFields', function(event,data) {
$("#formId").validate();

});
});         

XML
<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
Updated 24-Jul-12 2:21am
v7
Comments
ZurdoDev 23-Jul-12 10:22am    
What is a sj:submit and what is the actual problem?
HCIMS DEVELOPER 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
ZurdoDev 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.
HCIMS DEVELOPER 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900