Jump to content

How to add custom error message while saving product form with my module?


Recommended Posts

hello guys,

 I am facing a problem regrading my module.

 

I have a module which add a extra tab in product. In this tab i have a field. I want to display an error message when user enters wrong data in that field

 

now,

 

if(!empty($sampleObj) && isset($sampleObj->id)){
        
           $sampleObj->update();
            
        }

 

in this above condition , i want to check validation first and then this update() function to execute.

Right now please help me what to write in this braces to check the validation?

 

for example

if(!empty($sampleObj) && isset($sampleObj->id)){
        if($sampleObj->text=='Hello')

        {

 

                /*  What to write here for displaying error message and data will not be saved ?????  */

        }

       else

       {

              $sampleObj->update();

       }
        
            
        }

 

 

Please HELP.......

 

Thank you

Link to comment
Share on other sites

×
×
  • Create New...