0
我有一個頁面有2個按鈕,至少調用2個模式。一個頁面,兩個模式(2個不同的動作)
每個模式都有一個SUBMIT按鈕,我喜歡執行不同的操作。
我的問題是,當我打開第二個模式並嘗試提交表單時,第一個模態顯示所需字段的警告。
如何分別執行操作?在這種情況下或發送添加聯繫人表單或發送添加文檔表單?
謝謝大家。
按鈕1個添加聯繫人:
<a data-toggle="modal" href="#add_contact"><i class="icon-user-plus"></i> <? echo $msg['new']; ?> <? echo $msg['contact']; ?></a>
BUTTON 2 ADD DOCUMENT
<a data-toggle="modal" href="#add_document"><i class="icon-user-plus"></i> <? echo $msg['new']; ?> <? echo $msg['document']; ?></a>
1ST模態添加CONTACT
<!-- Add Contact MODAL -->
<div id="add_contact" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h5 class="modal-title"><? echo $msg['add_contact']; ?></h5>
</div>
<form method="post" id="message_add" class="form-validate-jquery" action="suppliers_inc.sql.php">
<input type="hidden" name="a" value="add_contact" />
<input type="hidden" name="supplier_id" value="<? echo $supplier_id ?>" />
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label><? echo $msg['contact_type']; ?> <span class="text-danger">*</span></label>
<select name="contact_type_id" class="select-search" required="required" data-placeholder="">
<?php
$query_contact_type = "SELECT DISTINCT type_id, type_description FROM supplier_contacts_type ORDER BY type_description";
$result_contact_type = $mysqli->query($query_contact_type);
while ($row_contact_type = $result_contact_type->fetch_assoc()) {
echo "<option></option>";
echo "<option value=\"{$row_contact_type['type_id']}\">";
echo $row_contact_type['type_description'];
echo "</option>";
}
?>
</select>
</div>
<div class="col-sm-6">
<label><? echo $msg['position']; ?> <span class="text-danger">*</span></label>
<input type="text" name="contact_position" required="required" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label><? echo $msg['name']; ?> <span class="text-danger">*</span></label>
<input type="text" name="contact_name" required="required" class="form-control">
</div>
<div class="col-sm-6">
<label><? echo $msg['surname']; ?> <span class="text-danger">*</span></label>
<input type="text" name="contact_surname" required="required" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-4">
<label><? echo $msg['telephone']; ?> <span class="text-danger">*</span></label>
<input type="text" name="contact_telephone" placeholder="Telefone FIXO" data-mask="99 9999-9999" required="required" class="form-control">
</div>
<div class="col-sm-4">
<label><? echo $msg['int']; ?></label>
<input type="text" name="contact_int" class="form-control">
</div>
<div class="col-sm-4">
<label><? echo $msg['hours']; ?></label>
<input type="text" name="contact_hours" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<label><? echo $msg['mobile']; ?></label>
<input type="text" name="contact_mobile" placeholder="Celular" data-mask="99 9-9999-9999" class="form-control">
</div>
<div class="col-sm-6">
<label><? echo $msg['email']; ?></label>
<input type="text" name="contact_email" class="form-control">
</div>
<div class="col-sm-3">
<label><? echo $msg['date_of_birth']; ?></label>
<input type="text" name="contact_date_of_birth" placeholder="dd/mm/aaaa" data-mask="99/99/9999" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-4">
<div class="checkbox">
<label>
<input type="checkbox" name="contact_default" class="control-primary">
<? echo $msg['default_contact']; ?>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal"><? echo $msg['close']; ?></button>
<button type="submit" class="btn btn-primary"><? echo $msg['save']; ?> <i class="icon-arrow-right14 position-right"></i></button>
</div>
</form>
</div>
</div>
</div>
<!-- /Add Contact MODAL -->
2ND模式添加DOCUMENT
<!-- Add Document MODAL -->
<div id="add_document" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h5 class="modal-title"><? echo $msg['add_document']; ?></h5>
</div>
<form method="post" id="document_add" class="form-validate-jquery" action="suppliers_inc.sql.php">
<input type="hidden" name="a" value="add_document" />
<input type="hidden" name="supplier_id" value="<? echo $supplier_id ?>" />
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label><? echo $msg['document_classification']; ?> <span class="text-danger">*</span></label>
<select name="classification_id" class="select-search" required="required" data-placeholder="">
<?php
$query_document_classification = "SELECT DISTINCT classification_id, classification_description FROM supplier_documents_classification ORDER BY classification_description";
$result_document_classification = $mysqli->query($query_document_classification);
while ($row_document_classification = $result_document_classification->fetch_assoc()) {
echo "<option></option>";
echo "<option value=\"{$row_document_classification['classification_id']}\">";
echo $row_document_classification['classification_description'];
echo "</option>";
}
?>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-12">
<label><? echo $msg['description']; ?> <span class="text-danger">*</span></label>
<input type="text" name="document_description" required="required" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-4">
<label><? echo $msg['issue_date']; ?></label>
<input type="text" name="contact_date_of_birth" placeholder="dd/mm/aaaa" data-mask="99/99/9999" class="form-control">
</div>
<div class="col-sm-4">
<label><? echo $msg['expiry_date']; ?></label>
<input type="text" name="contact_date_of_birth" placeholder="dd/mm/aaaa" data-mask="99/99/9999" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-4">
<div class="checkbox">
<label>
<input type="checkbox" name="contact_default" class="control-primary">
<? echo $msg['expiry_notification']; ?>
</label>
</div>
</div>
<div class="col-sm-4">
<div class="checkbox">
<label>
<input type="checkbox" name="contact_default" class="control-primary">
<? echo $msg['lock_supplier']; ?>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal"><? echo $msg['close']; ?></button>
<button type="submit" class="btn btn-primary"><? echo $msg['save']; ?> <i class="icon-arrow-right14 position-right"></i></button>
</div>
</form>
</div>
</div>
</div>
<!-- /Add Document MODAL -->