Hello all!
I have a list that displays the cloned pages from a template.
The list had an delete button. This button is used to open a bootstrap modal (i am using v3.3.7).
I have a single modal code that will trigger a modal whenever any delete button from the list is clicked. I want to be able to pass the k_page_id of the page to the modal so that I can use it to set a variable using cms:set. And then use the cms:set value to the page_id of the delete form.
The code looks like:
the line:
passes the value to the modal. but i want to use that value in <cms:form... mode='edit' page_id=recipient....>...</cms:form>
How can this be done?
Regards,
GenXCoders
I have a list that displays the cloned pages from a template.
The list had an delete button. This button is used to open a bootstrap modal (i am using v3.3.7).
I have a single modal code that will trigger a modal whenever any delete button from the list is clicked. I want to be able to pass the k_page_id of the page to the modal so that I can use it to set a variable using cms:set. And then use the cms:set value to the page_id of the delete form.
The code looks like:
- Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
<cms:template title='Modal' parent='_test_' />
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../assets/css/bootstrap.css">
</head>
<body>
<cms:pages masterpage="department/department.php">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="<cms:show k_page_id />">Open <cms:show k_page_title /></button><br>
</cms:pages>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="exampleModalLabel">New message</h4>
</div>
<div class="modal-body">
// Show data-whatever value in a variable
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Send message</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../assets/js/jquery-2.0.0.js"></script>
<script type="text/javascript" src="../assets/js/bootstrap.js"></script>
<script type="text/javascript">
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
var modal = $(this)
modal.find('.modal-title').text('New message to ' + recipient)
})
</script>
</body>
</html>
<?php COUCH::invoke( ); ?>
the line:
modal.find('.modal-title').text('New message to ' + recipient)
passes the value to the modal. but i want to use that value in <cms:form... mode='edit' page_id=recipient....>...</cms:form>
How can this be done?
Regards,
GenXCoders