2014-12-18 2 views
0

BootstrapDialog https://github.com/nakupanda/bootstrap3-dialog을 사용하여 모달 대화 상자에 내 편집 페이지를로드했지만 BootstrapDialog에서 제출 버튼을 클릭하여 폼을 제출하려면 어떻게해야합니까?BootstrapDialog Modal에로드 된 폼을 제출하는 방법

다음은 문제의 피델입니다. http://jsfiddle.net/philphil/ru1t1nc6/15/

페이지 편집

<form id="createEventForm" action="http://10.10.15.30:8000/attendee/edit" style="display:none" method="POST"> 
    <label for="first_name">First_name:</label> 
    <input name="first_name" value="Chris" id="first_name" type="text" /> 
    <label for="last_name">Last_name:</label> 
    <input name="last_name" value="Griffin" id="last_name" type="text" /> 
    <input type="submit" /> 
</form> 

JQuery와

$(document).ready(function() { 

    var form = $('#createEventForm').html(); 
    BootstrapDialog.show({ 
     title: 'Title', 
     message: form, 
     buttons: [{ 
      label: 'Update' 
     }] 
    }); 

}); 
+0

당신은 폼에 액션을 추가해야한다고 생각합니다. – ochi

+0

죄송합니다. 바이올린에 대한 간단한 양식을 만들었습니다. 문제는 여전히 다른 버튼에서 어떻게 제출합니까? – Phil

+1

버튼 클릭시 양식을 직렬화 할 수 있습니다. http://stackoverflow.com/questions/16154216/twitter-bootstrap-modal-form-submit을 참조하십시오. – ochi

답변

1

어떻게 버튼에 동작을 추가하는 방법에 대한 :

http://jsfiddle.net/ru1t1nc6/17/

,
BootstrapDialog.show({ 
     title: 'Title', 
     message: form, 
     buttons: [{ 
      label: 'Update', 
      action: function(dialog) { 
       // submit the form 
       $('form').submit() 
      } 
     }] 
    }); 
관련 문제