bernhard Posted January 2, 2016 Share Posted January 2, 2016 i really liked the "save + new" and "save + close" button back in my joomla days here is the first version of a module to bring this functionality to processwire. i know there's the save actions module, but that's not exactly what i wanted... module is alpha state https://github.com/BernhardBaumrock/SaveButtonEnhanced i have one problem where i need your help: i want to submit the #ProcessPageEdit form via a jquery click() event: https://github.com/BernhardBaumrock/SaveButtonEnhanced/blob/master/SaveButtonEnhanced.module#L126 but unfortunately that does not submit the form reliably. sometimes it works, sometimes it doesn't. most of the time i need a second click. also i was not able to trigger the click like this: $('body').on('click', '.sbe_action', function() { console.log('clicked a sbe item'); }); it just did nothing does anyone know what is the problem here? would really appreciate it. 4 Link to comment Share on other sites More sharing options...
rick Posted January 2, 2016 Share Posted January 2, 2016 I like this option. Regarding the intermittent click, maybe i glanced at it wrong, but aren't you already in the click event on line 128, and then executing another click on 131 for the same element? Link to comment Share on other sites More sharing options...
bernhard Posted January 2, 2016 Author Share Posted January 2, 2016 hi rick, thank you. $($(this).data('submit')).click(); should trigger the click on the connected button (can be "publish" or "save without publish" or just "save"). wich button to click is stored in the data attribute called "submit". values are taken from the $actions array: 'buttons' => array('#submit_save', '#submit_save_unpublished') so line 131 gets something like this: $('#submit_publish').click(); at least that is the plan Link to comment Share on other sites More sharing options...
bernhard Posted January 2, 2016 Author Share Posted January 2, 2016 ok i found it! the clicks didn't work when i was editing any field, so i added a second click to remove focus from the input // if any field has focus click the button twice if($('input:focus').length > 0) $($(this).data('submit')).click(); $($(this).data('submit')).click(); some other things... i'm not sure how the dropdown is positioned. there is this code: data-at='right bottom+1' i would prefer a left aligned dropdown like in the screenshots in the first post, but sometimes they are on the right side: another issue is when i click on the children tab it is anywhere in the middle: the module can be easily extended with other options - any ideas? Link to comment Share on other sites More sharing options...
bernhard Posted March 3, 2016 Author Share Posted March 3, 2016 as this is now built in the core i will not take this further... https://processwire.com/blog/posts/processwire-3.0.9-adds-new-long-click-and-save-actions/#new-page-edit-save-actions 2 Link to comment Share on other sites More sharing options...
adrian Posted March 3, 2016 Share Posted March 3, 2016 Thanks for your efforts on this anyway Benhard! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now