Forums

Function called inside another function doesn't work

Austre 17 Apr, 2013
Hi,

My Submit event has this structure below:


//Send email by Joomla Mailer
function reportError(){
  ...
}

function insertUser(){
  ...
  try{
    ...
  } catch (Exception $e) {
    reportError();
    return false;
  }
}

//Main code
if(!insertUser()){
  $form->validation_errors['db_errors'] = "Erro!";
  return false;
}


The reportError doesn't work in this structure above.

But, if the reportError was called in the Main Code, it works.


//Send email by Joomla Mailer
function reportError(){
  ...
}

function insertUser(){
  ...
  try{
    ...
  } catch (Exception $e) {
    reportError();
    return false;
  }
}

//Main code
if(!insertUser()){
  reportError();
  $form->validation_errors['db_errors'] = "Erro!";
  return false;
}


Why?😲
Max_admin 01 May, 2013
Hi,

Are you sure that the "try and catch" are done correctly ? maybe you should test without them first ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.