The button has to show modal with some data send through javascrip (onClick). Looking for hidden inputs, it seems to be correct. Each value input are feed. But the text inputs doesn’t work. I don’t understand why.
<form id="AdmForm" name="AdmForm" method="post" enctype="multipart/form-data">
<button type="button" class="modifScedule btn btn-lg gold" onclick="
document.forms['formAddSchedule'].noSchedule.value='1';
document.forms['formAddSchedule'].noEvent.value='1';
document.forms['formAddSchedule'].ACTION.value='modif';
document.forms['formAddSchedule'].adr.value='123 palm lane';
document.forms['formAddSchedule'].typPres.value='visio';"
<span class="glyphicon glyphicon-edit"></span>
</button>
</form>
Html modal form code. The problem is …
These input fields get feed without problem : noSchedule, noEvent and ACTION
But looking for the input fields, they stay blank : adr and typPres. So i would like to understand why ?
<div class="row">
<div class="col-sm-12">
<div class="form-content-AddSchedule" id="form-content-AddSchedule" style="display:none;">
<form class="form" role="form" name="formAddSchedule" id="formAddSchedule" action='index.php' method="post">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label for="adr"><h5>Site address</h5></label>
<input type="text" class="form-control" id="adr" name="adr" placeholder="Saisissez l'adresse du lieu" value="" >
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label for="adr"><h5>Presentation type</h5></label>
<input type="text" class="form-control" id="typPres" name="typPres" value="" >
</div>
</div>
</div>
<input type="hidden" name="noEvent" value="">
<input type="hidden" name="noSchedule" value="">
<input type="hidden" name="ACTION" value="">
</form>
</div>
</div>
</div>
Bootbox JQuery Code
<script>
$(document).ready(function() {
$(".modifScedule").on("click", function(event) {
var modal = bootbox.dialog({
message: $(".form-content-AddSchedule").html(),
title: "A title",
buttons: [
{
label: "Modify",
className: "btn btn-primary pull-left",
callback: function() {
$(".error").remove()
var proceed = true;
if (proceed == true) {
document.forms["formAddSchedule"].adr.value = $('#adr', '.bootbox').val();
document.forms["formAddSchedule"].typPres.value = $('#typPres', '.bootbox').val();
document.forms["formModifSchedule"].submit();
}
return false;
}
},
{
label: "Cancel",
className: "btn btn-default pull-left",
callback: function() {
}
}],
show: false,
onEscape: function() {
modal.modal("hide");
}
})
modal.modal("show");
});
});
</script>
