I've been looking for a while on how to resolve this issue but can't find anything about it or why it's not working
I want to delete some databound forms from list view. I've got the my_list.html in the snippets folder and I select a checkbox on the row in list view I want to delete and then click delete selected under the list but that don't do anything so I then select Delete in the dropdown list for bulk action with selected and click delete selected and the popup box appears that says "are you sure you want to delete the selected pages" so I click ok but nothing happens and it just refreshes the list view
Below is the my_list.html code from the snippets folder
So sorry but have tried to find out what the issue is or how to resolve it but it's beaten me this issue
In firefox on the console tab, it does say "Uncaught TypeError: window.addEvent is not a function"
Not sure if that's the issue or something else that's not letting me delete databound forms from the couchcms list view.
The template is clonable
The code from the contact.php is below
I tried config_list_view but that did not display the field names for some reason I needed so removed that code from contact.php and went back to the original code
I want to delete some databound forms from list view. I've got the my_list.html in the snippets folder and I select a checkbox on the row in list view I want to delete and then click delete selected under the list but that don't do anything so I then select Delete in the dropdown list for bulk action with selected and click delete selected and the popup box appears that says "are you sure you want to delete the selected pages" so I click ok but nothing happens and it just refreshes the list view
Below is the my_list.html code from the snippets folder
- Code: Select all
<cms:php>
// Set info about selected folder
global $DB, $CTX, $FUNCS;
$fid = ( isset($_GET['fid']) && $FUNCS->is_non_zero_natural($_GET['fid']) ) ? (int)$_GET['fid'] : null;
if( $fid ){
$rs = $DB->select( K_TBL_FOLDERS, array('name'), "id='" . $DB->sanitize( $fid ). "'" );
if( count($rs) ){
$fname = $rs[0]['name'];
}
}
$CTX->set( 'my_selected_fid', $fid, 'global' );
$CTX->set( 'my_selected_fname', $fname, 'global' );
</cms:php>
<cms:capture into='my_folders' scope='global'>
<cms:if k_folder_totalchildren >
<div class="bulk-actions">
<cms:dropdownfolders masterpage=k_template_name prompt='View all folders' hierarchical='1' selected_id=my_selected_fid />
<a class="button" id="btn_folder_submit"
href="<cms:admin_link />"
onclick="this.style.cursor='wait'; return false;" >
<span>Filter</span>
</a>
</div>
</cms:if>
</cms:capture>
<cms:capture into='my_list' scope='global'>
<table class="table table-primary table-list listing clear">
<thead>
<tr>
<th class="checkbox">
<input type="checkbox" name="check-all" onclick="$$('.page-selector').set('checked', this.checked);">
</th>
<!-- EDIT -->
<th>Name</th>
<th>Email</th>
<th>Phone Number</th>
<th>Service Type</th>
<th>Message</th>
<th>Consent Date/Time</th>
<th>Actions</th>
<!-- END EDIT -->
</tr>
</thead>
<tbody>
<cms:pages masterpage=k_template_name folder=my_selected_fname paginate='1' limit='15' show_unpublished='1' >
<cms:if k_paginated_bottom >
<cms:if k_paginator_required >
<cms:capture into='my_paginator' scope='global'>
<cms:php>
global $CTX, $FUNCS;
// Paginator assumes front-end template link as base. Make it point to the back-end.
$pagination_link = $CTX->get( 'k_page_being_paginated' );
$pagination_link = str_replace( $CTX->get('k_template_link'), $CTX->get('k_admin_link'), $pagination_link );
$CTX->set( 'k_page_being_paginated', $pagination_link );
</cms:php>
<cms:paginator adjacents='2' />
<div class="record-count">Showing <cms:show k_record_from />-<cms:show k_record_to /> / <cms:show k_total_records /></div>
</cms:capture>
</cms:if>
<cms:set row_class='last_row' />
</cms:if>
<!-- EDIT -->
<tr>
<td class="checkbox <cms:show row_class />">
<input type="checkbox" value="<cms:show k_page_id />" class="page-selector" name="page-id[]">
</td>
<td class="name <cms:show row_class />">
<a href="<cms:admin_link />" >
<cms:show name />
</a>
</td>
<td class="comments-count <cms:show row_class />"><cms:show email /></td>
<td class="folder <cms:show row_class />"><cms:show phone /></td>
<td class="folder <cms:show row_class />"><cms:show service_type /></td>
<td class="folder <cms:show row_class />"><cms:show message /></td>
<td class="date <cms:show row_class />"><cms:if k_page_date=='0000-00-00 00:00:00' >Unpublished<cms:else /><cms:date k_page_date format='d-m-Y \a\t H:i:s' /></cms:if></td>
<td class="actions <cms:show row_class />">
<!-- edit -->
<a class="icon tt" href="<cms:admin_link />" title="View"><svg class="i"><use xlink:href="<cms:show k_admin_link />theme/_system/assets/open-iconic.svg#magnifying-glass"></use></svg></a>
<!--<img src="<cms:show k_admin_link />theme/images/page_white_edit.gif" title="Edit">-->
</td>
</tr>
<cms:no_results>
<tr><td colspan="6" class="last_row" style="text-align:center">No pages found</td></tr>
</cms:no_results>
<!-- END EDIT -->
</cms:pages>
</tbody>
</table>
</cms:capture>
<form name="frm_list_pages" id="frm_list_pages" action="" method="post">
<div class="wrap-paginator">
<cms:show my_folders />
<cms:show my_paginator />
</div>
<div class="group-wrapper listing">
<cms:show my_list />
</div>
<div class="wrap-paginator">
<div class="bulk-actions">
<a class="button" id="btn_bulk_submit" href="#">
<span>Delete Selected</span>
</a>
</div>
<cms:show my_paginator />
</div>
<input type="hidden" id="nonce" name="nonce" value="<cms:php>global $FUNCS; echo $FUNCS->create_nonce( 'bulk_action_page' );</cms:php>">
<input type="hidden" id="bulk-action" name="bulk-action" value="delete">
</form>
<script type="text/javascript">
//<![CDATA[
window.addEvent('domready', function(){
if( $('btn_folder_submit') ){
$('btn_folder_submit').addEvent('click', function(e){
var link = this.href
var fid = $('f_k_folders').value;
if( fid != -1 ){
link += '&fid=' + fid;
}
document.location.href = link;
});
}
});
function k_hook_bulk_submit(){
if( $('btn_bulk_submit') ){
$('btn_bulk_submit').addEvent('click', function(e){
var col = $$('.page-selector');
for( var x=0; x<col.length; x++ ){
if( col[x].checked ){
if( confirm('<cms:php> global $FUNCS; echo $FUNCS->t('confirm_delete_selected_pages'); </cms:php>') ){
$$('body').setStyle('cursor', 'wait');
$('frm_list_pages').submit();
}
return false;
}
}
return false;
});
}
}
window.addEvent( 'domready', k_hook_bulk_submit );
//]]>
</script>
So sorry but have tried to find out what the issue is or how to resolve it but it's beaten me this issue
In firefox on the console tab, it does say "Uncaught TypeError: window.addEvent is not a function"
Not sure if that's the issue or something else that's not letting me delete databound forms from the couchcms list view.
The template is clonable
The code from the contact.php is below
- Code: Select all
<cms:set submit_success="<cms:get_flash 'submit_success' />" />
<cms:if submit_success >
<div class="alert alert-success">
<h4 class="text-dark"><strong class="text-dark">Success:</strong> Your form has been submitted.</h4>
</div>
</cms:if>
<cms:form
masterpage=k_template_name
mode='create'
enctype='multipart/form-data'
method='post'
anchor='0'
id='contact_form'
>
<cms:if k_success >
<cms:send_mail from=k_email_from to=k_email_to reply_to=frm_email subject='New Website Enquiry'>
The following is an contact form enquiry sent by a visitor on the contact page:
Name: <cms:show frm_name/>
<br>
Email: <cms:show frm_email/>
<br>
Phone: <cms:show frm_phone/>
<br>
Service Type: <cms:show frm_service_type/>
<br>
Message: <cms:show frm_message/>
<br>
Agree to privacy policy: <cms:show frm_agree/>
</cms:send_mail>
<cms:send_mail from='no-reply@beechwoodsolutions.co.uk' to="<cms:show frm_email />" subject='Privacy Policy Consent Confirmation'>
Hello <cms:show frm_name />,
You recently submitted an inquiry via our website and confirmed that you have read and agreed to our Privacy Policy.
Submission Details:
- Name: <cms:show frm_name />
<br>
- Email: <cms:show frm_email />
<br>
- Date & Time: <cms:date format='d-m-Y \a\t H:i:s' />
<br><br>
If you did not submit this request, please contact us.
Regards,
Hybrid IT Services
</cms:send_mail>
<cms:db_persist_form
_auto_title='1'
_invalidate_cache='0'
/>
<cms:set_flash name='submit_success' value='1' />
<cms:redirect k_page_link />
</cms:if>
<div class="row g-4">
<div class="col-lg-12">
<div class="field-set">
<cms:input id="name" name="name" class="form-control" placeholder="Your Name" type="bound" />
</div>
<div class="field-set">
<cms:input id="email" name="email" class="form-control" placeholder="Your Email" type="bound" />
</div>
<div class="field-set">
<cms:input id="phone" name="phone" class="form-control" placeholder="Your Phone" type="bound" />
</div>
<div class="field-set">
<cms:input id="service_type" name="service_type" type="bound" class="form-control" />
</div>
<div class="field-set">
<cms:input id="message" name="message" class="form-control h-100px" placeholder="Your Enquiry" type="bound" />
</div>
<div class="field-set">
<label for="agree" class="text-light">
<cms:input id="agree" name="agree" type="bound" />I have read and agree to the <a href="privacy-policy.php" target="_blank">Privacy Policy</a>
</label>
</div>
</div>
</div>
<div id='submit' class="mt-3">
<cms:if "<cms:not submit_success />" >
<input type='submit' id='send_message' value='Send Message' class="btn-main">
</cms:if>
</div>
</cms:form>
I tried config_list_view but that did not display the field names for some reason I needed so removed that code from contact.php and went back to the original code