BillPull
BillPull

Reputation: 7013

Form does not submit in IE

I am working on a submission form that wont submit in IE. I did not write the code was wondering if there is something glaringly obvious going on here that IE dislikes.

   $(function(){
      {% if show_existing_form == False %}
    $('#publisher-signup').toggle();
    $('#existing-user-pub-signup').toggle();
      {% endif %}

      $('#new-user').click(function() {
    $('#publisher-signup').toggle();
    $('#existing-user-pub-signup').toggle();
      });

      $('#existing-user').click(function() {
    $('#publisher-signup').toggle();
    $('#existing-user-pub-signup').toggle();
      });

      var disable_submit = function() {
    if ($('#publisher-submit').attr('disabled') !== 'disabled') { 
      $('#publisher-submit').attr('disabled', 'disabled');
    }
      };

      var enable_submit = function() {
    if ($('#publisher-submit').attr('disabled') === 'disabled') { 
      $('#publisher-submit').removeAttr('disabled');
    }
      };

      var check_passwords_match = function() {
    if ($('#password').val().trim() === '' || $('#confirm-password').val().trim() === '') {
      disable_submit(); 
    } else if ($('#password').val() !== $('#confirm-password').val()) {
        $('#password-mismatch').show();
        disable_submit();
    } else {
        $('#password-mismatch').hide();
        enable_submit();
    }
      };

      $('#confirm-password').change(check_passwords_match);
      $('#password').change(check_passwords_match);

      $('#email').change(function() {
        $.ajax({
            'url': '/preview',
            'type': 'POST',
            'data': {
                    'check-username': true,
                    'email': $('#email').val()
                },
            'success': function(data, textStatus, jqXHR) {
                        if (data.exists === true) {
                            $('#user-exists').removeClass('hide');
                        } else {
                            $('#user-exists').addClass('hide');
                        }
                   }
        });
      });

      $('#existing-submit-btn').click(function(){
        $('#publisher-existing-signup').submit();
      });

      $('#publisher-submit-btn').click(function(){
    $('#publisher-purchase').submit();
      });
});

Upvotes: 2

Views: 373

Answers (1)

Adam Rackis
Adam Rackis

Reputation: 83376

The problem is likely with one or both of these:

$('#existing-submit-btn').click(function(){
    $('#publisher-existing-signup').submit();
});

$('#publisher-submit-btn').click(function(){
    $('#publisher-purchase').submit();
});

It looks like a submit button on one form is being used to submit another form, but the default action of the first is never cancelled. Try changing it to:

$('#existing-submit-btn').click(function(){
    $('#publisher-existing-signup').submit();

    return false;
});

$('#publisher-submit-btn').click(function(){
    $('#publisher-purchase').submit();

    return false;
});

Upvotes: 1

Related Questions