PauloV Posted June 3, 2015 Report Posted June 3, 2015 Hello On module tab navigation, how to set up error messages on the fly? Exemple: We have the opensrs module, wen there is an error conecting or getting any data, for exemple we want to display the error message and it dosent display wen navigating on the TABS On the outher hand we have sucessful add the error message wen POST the form like so: $errors[] = "my error message"; $this->Input->setErrors(array('errors' => $errors)); but dont work wen loading TABS only POST/Modifying the module options Thanks in advance for any help Blesta Addons 1 Quote
Tyson Posted June 4, 2015 Report Posted June 4, 2015 The short answer is you can't. Messages are handled at a higher level and there isn't yet a way to set specific messages from the module. Quote
Blesta Addons Posted June 5, 2015 Report Posted June 5, 2015 The short answer is you can't. Messages are handled at a higher level and there isn't yet a way to set specific messages from the module. i have already asked about this feature in this threads http://www.blesta.com/forums/index.php?/topic/3879-allow-module-to-set-message-like-seterrors/ and the answer was http://dev.blesta.com/browse/CORE-1269 , now i'm shaked that is not possible ?!!!! is really good feature . PauloV 1 Quote
Tyson Posted June 5, 2015 Report Posted June 5, 2015 i have already asked about this feature in this threads http://www.blesta.com/forums/index.php?/topic/3879-allow-module-to-set-message-like-seterrors/ and the answer was http://dev.blesta.com/browse/CORE-1269 , now i'm shaked that is not possible ?!!!! It's not possible until that task is complete. Quote
Blesta Addons Posted June 5, 2015 Report Posted June 5, 2015 It's not possible until that task is complete. the task is related to solusvm module , but in the reality this task is concerned by all other modules . is important to be added as soon as possible . Quote
PauloV Posted June 6, 2015 Author Report Posted June 6, 2015 I think i have a solution and I will try on Monday We cannot set error messages but we can send error messages as $var to the .tpl file of the plugin/module Blesta Addons 1 Quote
Blesta Addons Posted June 6, 2015 Report Posted June 6, 2015 I think i have a solution and I will try on Monday We cannot set error messages but we can send error messages as $var to the .tpl file of the plugin/module in this case you will need to add html code for success and errors messages . and the probleme in this solution is that some module not using the $var anyelese , so it need to be adjusted in the related module . i have another solution that i have used before , but i don't know hwy i have stopped using it . my solution was based in the same idea of blesta message , i found blesta add a cookies just for the flash messages , so i have write my own function to store the message in the cookies , and when blesta load, it always fetch the cookies for flash messages nad lood it . it worked like a charm , but i have not understand what was the probleme in that time !!! PauloV 1 Quote
Blesta Addons Posted June 6, 2015 Report Posted June 6, 2015 you can test with this code , of course load the session model . $this->Session->write('flash', array( "message" => "Success Message" ) ); PauloV 1 Quote
PauloV Posted June 8, 2015 Author Report Posted June 8, 2015 Thanks for the help naja7host Because Im only using the warnings for my Modules/Plugins I will use my internal var "ierror" (internal error lol), and I will add the extra lines of code (untill blesta devs include in core the soltuion) The error messages are very handy, because we dont know if there is a problem wen managing a module/plugin only spending some minutes debugging or seeing logs Here is the solution for displaying error messages on Modules/Plugins in Tabs navigations (wen not posting/submiting forms), on the fly: On your module/plugin just add the a var to colect the error message wen not post/submit form like this exemple: $vars->ierror = "my error message"; //colect and send the error message to .pdt on your .pdt file add on top this code: <?php if ($this->Html->ifSet($vars->ierror)){ ?> <div class="error_section"> <article class="error_box error"> <a href="#" class="close">×</a> <p style="padding:0px 0px 0px 30px; vertical-align: middle;"><?php echo $this->Html->ifSet($vars->ierror); ?></p> </article> </div> <?php } ?> Nad its working on all my modules/plugins, displying the error message directly from the API of my Module/Plugin, insted of going in Tools->Logs to see what went rong Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.