2012-11-23 3 views
1

addForm이 양식 ID로 사용되었지만 양식 제출이 firefox에서 작동하지 않습니다.document.addForm.submit()이 (가) 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}); 
    } 
}); 
+0

양식을 addform id와 관련하여 제출해야합니다. – user1847416

답변

1

사용

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

또는 크로스 브라우저 솔루션

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

.

Internet Explorer는이 ID를 가진 요소가 있지만 올바르지 않은 비표준 동작이므로 addForm이라는 전역 변수를 추가합니다.

0

jquery를 사용하는 것 같습니다. 다음 양식을 통해 간편하게 양식을 제출할 수 있습니다.

$("#addForm").submit(); 
관련 문제