Welcome Guest, Not a member yet? Register   Sign In
Continuous Loop in form validation
#10

[eluser]cideveloper[/eluser]
A couple things I would change.

1) your javascript

Code:
$('#myForm').submit(function(e){
    e.preventDefault();
    v_kunstwerk = $('input[name="kunstwerk"]').val();
    if (v_kunstwerk != null) {
        $.post($(this).attr('action'),$(this).serialize(),function(data){
            $('#error').text(data);
        }, 'text');
    }
});


This way you can take this file out of your views and put it into an external js where it belongs.


Also in your code if Javascript is disabled and the form is submitted the user will be sent to art_controller/submit/22 and if validation fails they will just see the error message and NOT be sent back to the form with the error.

Not good in my opinion

I will update soon with a controller I think will be better


Messages In This Thread
Continuous Loop in form validation - by El Forum - 01-06-2011, 05:17 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 06:23 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 07:00 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 07:17 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 11:26 PM
Continuous Loop in form validation - by El Forum - 01-07-2011, 04:12 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 05:01 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 08:50 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 09:02 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 11:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB