表格不在IE中提交

时间:2022-10-07 20:30:41

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.

我正在处理一份不会在IE中提交的提交表单。我没有写代码,想知道是否有一些明显的东西在这里,IE不喜欢。

   $(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();
      });
});

1 个解决方案

#1


1  

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;
});

#1


1  

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;
});