Jump to content

Recommended Posts

Posted

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?

Posted

How about this in the execute function?

if($this->config->ajax && $this->input->post->message){
  $this->message($this->input->post->message);
  return;
}
Posted

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.

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...