In the facebox modal window, a facebox form is displayed.
When you click the send button, you need to check whether the checkbox is selected and if one of the last two is selected, whether the appeared field is filled.
The problem is that when
submitgoes, the facebox window closes. If it is impossible to send a form to facebox without closing the window, then you need to somehow extract the data from the form by substituting it with$.get();to change the content in the window without restarting it.
Tell me please.
<form id="pichform" method="post" action=""> <div id="search-modal-title">Укажите в чём нарушение</div> <input value="Фотографии не отображаются" name="prichina" type="radio" id="1" /> <label style="display: inline-block; cursor: pointer;" for="1">Фотографии не отображаются</label><br /> <input value="На фото не грибы и ничего похожего на грибы" name="prichina" type="radio" id="2" /> <label style="display: inline-block; cursor: pointer;" for="2">На фото не грибы и ничего похожего на грибы</label><br /> <input value="Фото слишком плохого качества" name="prichina" type="radio" id="3" /> <label style="display: inline-block; cursor: pointer;" for="3">Фото слишком плохого качества</label><br /> <input value="Мытые либо слишком старые грибы" name="prichina" type="radio" id="4" /> <label style="display: inline-block; cursor: pointer;" for="4">Мытые либо слишком старые грибы</label><br /> <input value="Грибы разных видов в одном вопросе" name="prichina" type="radio" id="5" /> <label style="display: inline-block; cursor: pointer;" for="5">Грибы разных видов в одном вопросе</label><br /> <input value="Дубликат" name="prichina" type="radio" id="6" /> <label style="display: inline-block; cursor: pointer;" for="6">Дубликат</label><br /> <span id="urls" style="display: none;"> Адреса дубликатов:<br /> <textarea name="urls" style="width: 300px; height: 50px;"></textarea><br /> </span> <input value="Другое" name="prichina" type="radio" id="7" /> <label style="display: inline-block; cursor: pointer;" for="7">Другое</label><br /> <span id="drugoe" style="display: none;"> Укажите причину:<br /> <textarea name="drugoe" style="width: 350px; height: 100px;"></textarea><br /> </span> </form> <button style="margin-top: 20px;" onclick="SubmForm(); false;">отправить</button> <script type="text/javascript"> jQuery(document).ready(function ($) { $('#1,#2,#3,#4,#5').change(function(){ $('#urls').hide(); $('#drugoe').hide(); }); $('#6').change(function(){ $('#urls').show(); $('#drugoe').hide(); }); $('#7').change(function(){ $('#urls').hide(); $('#drugoe').show(); }); }); function SubmForm() { //проверки if ($('#1,#2,#3,#4,#5').change()){ $( "#pichform" ).submit(); } </script>
onclick="SubmForm(); return false;". Secondly, what is the point of this testif ($('#1,#2,#3,#4,#5').change())? Third, call$("#pichform").submit();causes the page to reload, so it seems to you that the "facebox window is closing." - Igor($('#1,#2,#3,#4,#5').change())- I wanted to check the form for the presence of the selected checkbox - Leonid Ozerny