如何使用回调确认使用回调的bootbox在javascript中提交我的表单

时间:2016-03-10 13:18:17

标签: javascript php html

仅当按下按钮完成表单时,才会运行以下脚本。但是,我打算,当你看到我的bootbox确认他是否确认没问题时,他确实认为它打算形成Finish按钮Order。如果取消,我希望它执行删除按钮表单的设计。

    <script type="text/javascript">
    function timeLock(){
    var getTime = new Date();
var getHours = getTime.getHours();
var getMinutes = getTime.getMinutes();

    if (getHours > 18 || getHours > 09){
        //if (getHours >= 18 && getMinutes >= 30){
    bootbox.confirm({ 
   size: 'small',
   message: '<div class="row">  ' +
             '<br><br>' +
             '<div class="col-md-3" align="center"> ' +
             '<i class="fa fa-shopping-cart fa-4x"></i>' +
             '</div>' +
             '<div class="col-md-9">Encomendas efectuadas após as 18:30H só serão processadas internamente no dia seguinte.<br>Deseja prosseguir com o envio da encomenda?</div> ' +
             '</div>',
    callback: function (result){ 
        if (result==true) {
       $('#form').submit();
    } else {
       $('#delete').submit();
    }
    }
})
    return false;
}//}
else
return true;
}
</script>


// and my form 

<form  method="post" action='encomenda.php' role="form" >
<button align="center" type="submit" id="delete" name="submit" value="delete">Remover</button>
<button class="button_fullwidth"  onClick="return timeLock();" type="submit"  id='form' name="save">Concluir Encomenda</button>
</form>

0 个答案:

没有答案