last day (14 days later) » 

8:44 AM
0
Q: Form not submitting using jquery validation plugin

rockingI am using jquery validation plugin for validation.It works well but the form never gets submited.The following is my js code.I do not get any any errors in console.I have tested it using chrome,mozilla but the form never submits even if I enter proper datas.I am not including html codes but If r...

 
any error in your console
 
@ArunPJohny no error at console
@ArunPJohny do you need html codes?
 
@ArunPJohny BUt in my case its not submitting
 
can you check whether the validation is happening also whether the submit handler is getting called
 
8:44 AM
@ArunPJohny Can you please have a look at my full code pastie.org/9398517
@ArunPJohny are there any prbls with my html code?
 
looking at that
 
@ArunPJohny when I remove the remote section
remote: {
                url: projectUrl+"checkIfEmailExists",
                type: "post",
                data: {
                	emailExists: function() {
                    return $( "#emailAddress" ).val();
                  }
                },
        success: function (data) { //returns 1 if user exists
            if (data) {
               console.log(data);


               $('#confirmation').html(data);



               return true ;
            } else {
               console.log("false");
then form gets submitted
so the problem lies in the remote part
@ArunPJohny but I am not getting where is the error in remote part
 
let me see
 
ok thanks
 
which browser is used
 
8:56 AM
chrome and mozilla
@ArunPJohny
 
whether the page is loaded from localfile system
using file:// protocol ?
 
@ArunPJohny sorry did not understand
actually I am implementing using spring
This is my controller code
@ResponseBody
	@RequestMapping("/checkIfEmailExists")
	public Boolean checkIfEmailExists(@RequestParam("emailExists") String email)
	{
		boolean exists=clientServiceImpl.checkIfEmailExists(email);
		System.out.println("cleint contorller "+exists);

		return exists;

	}
I am not allowing users to enter duplicate emails
so if email is already present then
 $('#confirmation').html(data);
is executed
after that if I re enter another email address then it does not submit
 
9:19 AM
@ArunPJohny any sols
even I tried to submit on click function
$('#submitButton').click(function(){
	alert($('#form').valid());
	if ($('#form').valid())
	    $('#form').submit();

});
stilll it do not submit
 
can you remove the success handler from the remote rule
 
yes I did that
removed the success handler
 
also whether the ajax rule is working fine?
is it returning a 200 ok
 
and tried to submit using click function.I can see alert($('#form').valid()); shows true
In google chrome when I open the developer tools and inside the network I can see 200 ok
if this is what you mean ajax rule
 
I really don't have a fix
but the problem is with the ajax rule
where a internal count pendingRequest is not rested properly
 
9:28 AM
so what to do now?
 
the internal ajax request doesn't have a error handler and does not allow you to supply a success handler
so if your ajax request is not successful it won't work
 
so better I will stay away with this plugin?
if yes can you suggest good plugin
 
it is a great plugin
and I uses the plugin always
 
but it does not work for me
 
but this particular case I haven't faced
 
9:31 AM
Can you please any other plugin?
which you have worked on
 
your ajax request is suppose to return a value true if the value is correct
 
my ajax success gives boolean values
if the email exists in the database then it will return true else false
 
in that case it should work fine
 
unfortunately it does not work
@ArunPJohny finalyy I found the solutions
remove the remote part
and in the success handler
submitHandler: function (form) {
        //$("#submitBtn").prop("disabled", true); //disable to prevent multiple submits
        //form.submit();
        var email=$( "#emailAddress" ).val();
        $.ajax({
			type: "POST",
			url: projectUrl+"checkIfEmailExists",
			data:{"emailExists":email},
			success:function (data1) {
				//location.reload();
				alert("email exists");
				if(data1)
					{
					$( "#emailAddress" ).val('');
					}
				else
					{
					form.submit();
					}
			}
});
    //alert('hi');
I am checking if the user is present or not
if present then I am making the email field empty
and do not submit the form
and if not then submit the form
Thanks for trying to help
 

last day (14 days later) »