Jump to content

Recommended Posts

Posted

Hello :blesta:

 

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 ;)
Posted

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.

Posted
  On 6/4/2015 at 12:03 AM, Tyson said:

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 .

Posted
  On 6/5/2015 at 11:49 PM, Tyson said:

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 .

Posted
  On 6/6/2015 at 8:31 AM, PauloV said:

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 !!! 

Posted

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 :blesta:

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...