user1847416
user1847416

Reputation: 11

document.addForm.submit() not working in firefox

addForm is used as the form id, but the form submit is not working in firefox.

$(function() {
 var date = $("#todo_due").val();
 var text = $("#todo_due").val();
  if (date && text) {
    document.addForm.submit();
  } else if (!date && !text) {
    new Messi('{$LANG.main.todo_validation}', {ldelim}title: '{$LANG.error.error}', titleClass: 'info', modal: true{rdelim});
  } else if (!text) {
    new Messi('{$LANG.main.todo_validation_desc}', {ldelim}title: '{$LANG.error.error}', titleClass: 'info', modal: true{rdelim});
  } else {
    new Messi('{$LANG.main.todo_validation_date}', {ldelim}title: '{$LANG.error.error}', titleClass: 'info', modal: true{rdelim});
  }
});

Upvotes: 1

Views: 236

Answers (2)

Seybsen
Seybsen

Reputation: 15572

You seem to use jquery. You can easyly submit the form by:

$("#addForm").submit();

Upvotes: 0

Denys Séguret
Denys Séguret

Reputation: 382092

Use

document.getElementById('addForm').submit();

or

$('#addForm').submit();

for a cross browser solution.

Internet Explorer adds a global variable called addForm because you have an element having this ID but it's an incorrect and non standard behavior.

Upvotes: 1

Related Questions