Marc Posted November 10, 2015 Share Posted November 10, 2015 I'm working on an admin module and I'm using the build in notification system for messages, errors and warnings, which works great. Some of my forms are handled by ajax however, and it would be nice if there was a javascript equivalent of $page->message("hi there"), like there is for the SystemNotifications module. (Which works like Notifications.message("Message to send").) I currently have a custom notification system for ajax in place, but it would be nice if I could use something purely PW. Can this be done? Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 10, 2015 Share Posted November 10, 2015 How about this in the execute function? if($this->config->ajax && $this->input->post->message){ $this->message($this->input->post->message); return; } Link to comment Share on other sites More sharing options...
Marc Posted November 11, 2015 Author Share Posted November 11, 2015 How about this in the execute function? if($this->config->ajax && $this->input->post->message){ $this->message($this->input->post->message); return; } Well yeah, that's the PHP part of the ajax function, but to display the actual message without refreshing the page some javascript magic will have to happen. I'm sorry if I didn't make myself clear, but the real question is: is there a build in javascript function I can use to display these messages? I would like to use that instead of my custom functionality if possible. Like there is for the SystemNotifications module, as Ryan explains here. I tried that module but for my purposes it's not the right fit. Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 11, 2015 Share Posted November 11, 2015 There's nothing in the processwire core besides the system notifications module, no matter if php or js code. If you need additional logic in it you'd need to extend those files or use a fully custom solution. Link to comment Share on other sites More sharing options...
Marc Posted November 11, 2015 Author Share Posted November 11, 2015 That's what I feared. Thanks for the confirmation. I'll use my own solution then 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