Home › Toolset Professional Support › [Resolved] call jquery after cred-delete-post
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
This topic contains 28 replies, has 2 voices.
Last updated by Christopher Amirian 2 years, 5 months ago.
Assisted by: Christopher Amirian.
Hi, how do that?
I would like to .hide() the post ("wunsch") after deleting it.
Thank you 🙂
Hi there,
The "cred-delete-post" shortcode reloads the page after deleting a post. Alternatively, you can provide the POST ID to load after deleting the post under the "onsuccess" attribute. For more information:
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-post
Now I am not sure what you want to achieve by adding a Javascript code. If you give me the link of the page and more description I might be able to understand.
Thank you.
hidden link
I want a post to disappear from that list after deleting it.
The list, however, should stay.
Thank you 🙂
Hi there,
Unfortunately I have no access and it shows No Items Found.
Would you please add a few sample items there and also share the login information so tghat I can test and see what is going on?
You need to set the next reply as private.
Thanks.
Hi there,
I checked the page and it is working as expected without any need to add Javascript code.
So I clicked the Delete option (LÖSCHEN) and the page reloads and does not show the deleted content anymore.
I checked and deleted two posts and now the list shows one post:
hidden link
Everything wors as expected.
Ok - but is it possible WITHOUT reloading the page?
As reloading would be VERY misleading if someone had say 20 or 30 posts in that list...
And .hide() would be so easy,,,
Hi there,
I see what you mean now. Thre is no option for that as the Do Nothing option for the delete link will remove the post in the backend and there is no reference to be able to detect which post is deleted.
The best way is to implement the feature other way around.
Please kindly read this answer to know what to do and set to add the delete feature and do the post deleting by custom code:
https://toolset.com/forums/topic/delete-post-link-with-no-reference-to-wp-admin/#post-1342577
Thanks
Done all that, nothing happens.
This is SO bad - isn´t it a BASIC function to delete a post?
Hi there,
The Delete functionality is available with the page load and not the Ajax form. You are welcomed to ask for a feature request for that option:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
As for the workaround that I mentioned, I'd be happy to check and see how you implemented it.
I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.
Make sure you set the next reply as private and give me the link to the form that you created and the link to the content template and the view.
Thanks
Hi there,
I checked and there were two issues:
1. You set the form to New content instead of the Existing Content. I fixed that.
2. Also, you added the code to a plugin called Snippets. To be on the safe side I added to the Toolset Custome code:
Now that the system is working by the post form, it is possible to use the jQuery Hide on the form submit. That is why I added the Javascript code below to the JS Editor of the Meine Wunsche view:
jQuery(document).ready(function($) { $('form[id^="cred_form_4485"]').on('submit', function() { $(this).closest('.archiveintrag').hide(); }); });
Now if you check the listing it hides the post and also removes using the method mentioned in the previous reply.
Thanks.
Thank you, Christopher.
This DID work once, but now it doesn´t anymore.
Did you change anything again lately?
Hi there,
I did not change anything in the code. I tested it again and it is working correctly for me.
Here is a video that I recorded:
hidden link
Thanks
Ok, this really seems to work now.
I´m really sorry if I was wrong there.
Glad you put that jQuery in the post template, not in the view.
THANK YOU, CHRISTOPHER - great work!
Still one problem: How make .hide() work in the VIEW 4029 too?
jQuery(document).on('js_event_wpv_pagination_completed', function(event, data) { $('form[id^="cred_form_4485"]').on('submit', function() { $(this).closest('.archiveintrag').hide(1500); }); }); jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) { $('form[id^="cred_form_4485"]').on('submit', function() { $(this).closest('.archiveintrag').hide(1500); }); });
doesn´t work.
THANK YOU
That is in hidden link