2016-10-13 6 views
0

jquery 대화 상자를 사용하고 있기 때문에 페이지에 모달 양식을 표시하려고합니다. 그러나 폼이 수행 할 때 대화 상자의 단추가 나타나지 않습니다.jquery 대화 상자의 버튼이 표시되지 않습니다.

여기 대화 만드는 자바 스크립트입니다 :

function showform() { 
    $("#formplan").dialog({ 
    open: function(event, ui) { 
     $(".ui-dialog-titlebar-close").hide(); 
    }, 
    modal: true, 
    autoOpen: false, 
    dialogClass: "dialogform", 
    buttons: [{ 
     text: "Planifier", 
     click: function() { 
      $("#formplan").dialog("close"); 
      $("#formplan").submit(); 
     } 
    }, { 
     text: "Cancel", 
     click: function() { 
      $("#formplan").dialog("close"); 
      $("#formplan").dialog('destroy').remove(); 
     } 
    }] 
    }); 
    $("#formplan").dialog('open'); 
}; 

을 그리고 여기에 양식이 스크립트에 대한 호출과 함께 포함되어 있습니다 :이 코드는 자바를 사용하여 HTML에 밀려

<div id="formplan" class="dijitDialog" role="dialog" style="display:none"> 
    <form style="" action="javascript:refreshTab('tabadministrationplanificateurtaches', '/profusion/scheduler/etat.html?onglet=tabadministrationplanificateurtaches&mode=integre&planed=ImportPays ' + getfromform())"> 
     <br>planification de la tache ImportPays : 
     <br> 
     <input type="radio" name="periodicity" value="1" checked> tout les jours 
     <br> 
     <input type="radio" name="periodicity" value="2"> par jours de la semaine : 
     <input type="checkbox" name="Daysofweek" value="1"> dimanche 
     <input type="checkbox" name="Daysofweek" value="2"> lundi 
     <input type="checkbox" name="Daysofweek" value="3"> mardi 
     <input type="checkbox" name="Daysofweek" value="4"> mercredi 
     <input type="checkbox" name="Daysofweek" value="5"> jeudi 
     <input type="checkbox" name="Daysofweek" value="6"> vendredi 
     <input type="checkbox" name="Daysofweek" value="7"> samedi 
     <br> 
     <input type="radio" name="periodicity" value="3"> par mois : 
     <input type="text" name="Daysofmonth" placeholder="ex : 1:3:21"> 
     <br>effectuer à : 
     <input type="text" name="hours" placeholder="ex : HH:mm:ss/HH:mm:ss"> 
     <br> </form> 
</div> 
<script> 
    showform(); 
</script> 

, showform()을 호출하는 스크립트는 필요한 경우에만 존재합니다. 또한, 심지어 내가 페이지 뒤쪽에있는 modal:true을 눌러도 계속 클릭 할 수 있다는 것을 알았습니다. 그리고 페이지를 생성하는 버튼을 클릭하면 (프로세스에서 새로 고침을하는 것) 내 양식이 두 번 나타납니다. 내 생각 엔 showform()의 전화에서 직접 온 것입니다 (onclick() 이벤트에 연결되지 않음).

감사합니다,

답변

1

자바 스크립트로 당신의 showform() 함수를 내가 폼 사업부에서 id="formplan" 이동이

$(document).ready(function() { 
     showform(); 
    }); 

jsFiddle link

0

같은 파일을 호출하고 트릭을 할 듯 . 또한 @ zakaria처럼 document.ready()에 showform()에 대한 호출을했습니다.

관련 문제