Hi
I can't get the error or success messages after submiting a form.
My form is a DBF inside a bootstrap modal window.
Even though I use 'cms:set_flash' and 'cms:get_flash' to set and get the success or error messages, it seems these are gone after the form submission.
Here is my code:
Am I doing something wrong? And is there an easy way to get these error and success messages from the DBF?
NB:Apologies if this question already was answered. I google for it and saw some related post, but they don't have a solution to the issue I'm seeing.
I can't get the error or success messages after submiting a form.
My form is a DBF inside a bootstrap modal window.
Even though I use 'cms:set_flash' and 'cms:get_flash' to set and get the success or error messages, it seems these are gone after the form submission.
Here is my code:
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='mytemplate' clonable='1'>
<cms:editable name='message' type='text' required='1' />
</cms:template>
<html lang="en">
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<cms:get_flash name='alert' />
<cms:if alert>
<h3>Your form was not submitted</h3>
<cms:each alert sep='\n'>
<cms:show item /><br>
</cms:each>
</cms:if>
<cms:get_flash name='success' />
<cms:if success>
<h3>Your form is submitted</h3>
<cms:each success sep='\n'>
<cms:show item /><br>
</cms:each>
</cms:if>
</div>
<div class="row">
<cms:pages masterpage='test-modal.php' >
<cms:show message /><br />
</cms:pages>
</div>
<div class="row">
<a href="#" data-toggle="modal" data-target="#add" >
<button type="button" class="btn btn-lg">Add a message <span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</a>
</div>
<div id="add" class="modal fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-info">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add your message</h4>
</div>
<cms:form
name='create_record'
masterpage='test-modal.php'
mode='create'
enctype='multipart/form-data'
method='post'
anchor='0'
>
<cms:if k_success >
<cms:db_persist_form
_invalidate_cache='0'
_auto_title="1"
/>
<cms:set_flash name='success' value=k_success />
<cms:redirect url="<cms:link masterpage='test-modal.php' />" />
</cms:if>
<cms:if k_error >
<cms:set_flash name='alert' value=k_error />
<cms:redirect url="<cms:link masterpage='test-modal.php' />" />
</cms:if>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="input_message">Your message</label>
<cms:input name='message' type='bound' class="form-control" id="input_message" placeholder="Give your feeedback here" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button>
<button type="submit" name='submit' class="btn btn-primary">Add</button>
</div>
</cms:form>
</div>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php COUCH::invoke(); ?>
Am I doing something wrong? And is there an easy way to get these error and success messages from the DBF?
NB:Apologies if this question already was answered. I google for it and saw some related post, but they don't have a solution to the issue I'm seeing.