Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 29. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Add page pre trigger return false button problem?

phpMyEdit Configuration     Add page pre trigger return false button problem?
Odoslať novú tému   Odpovedať na tému    
 
chris209348     Založený: 22.04.2009   Príspevky: 3  
Príspevok Zaslal: 2009-04-22 15:44
Návrat hore  Odpovedať s citátom     

Hi All,

I am using a pre-trigger which can return false. When it does the main view table is displayed but the buttons are "SAVE, MORE, CANCEL".

Is this a bug, I thought it is supposed to just go back to the main view propper? I can work around.

Chris

 
KarelB     Založený: 01.06.2007   Príspevky: 24  
Príspevok Zaslal: 2009-04-24 11:20
Návrat hore  Odpovedať s citátom     

Chris,

I found the same problem, If this is a bug or intentional I do not know.
The work around I use is to echo the following in my trigger as the last line if the result is false:
Kód:

echo '<script language="javascript">history.go(-1)</script>';


Works for me.

Karel

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-04-25 13:46
Návrat hore  Odpovedať s citátom     

Perhaps you can alter your pre-trigger to return a value other than FALSE and then evaluate whether or not phpMyEdit should continue, or not. Below is an example of trapping validation errors and terminating execution.

Kód:
$errors = array();

$nothing = 'Nothing entered. Please go back.';

if($newvals['name'] == ''){

   $errors['name'] = $nothing;

}elseif(strlen($newvals['name']) < 5){

   $errors['name'] = '&quot;'.$newvals['name'].'&quot; - Entries must be at least 5 characters long';

}

if(strlen($newvals['hex']) == ''){

   $errors['hex'] = $nothing;

}elseif(strlen($newvals['hex']) < 5){

   $errors['hex'] = '&quot;'.$newvals['hex'].'&quot; - Entries  must be at least 5 characters long';

}

if(empty($errors)){

   return true;

}else{

   foreach($newvals as $key => $value){

      $this->fdd[$key]['default'] = $value;

   }

   echo "\n".'<div style="background-color:#ffff00;color:#ff0000;padding:10px;margin:20px;border:1px solid #ff0000">';

   echo "\n".'<p>Problem</p>';

   foreach($errors as $key => $val) {

      echo "\n".'<ul><li>';

      echo "\n".'<strong>'.$this->fdd[$key]['name'].'</strong>';

      echo "\n".'<br>'.$val;

      if($opts['fdd']['default'] = ''){

         echo "\n".'<br>The default value for '.$this->fdd[$key]['name'].' is '.$opts['fdd']['default'];

      }

      echo "\n".'<br>Help: '.$this->fdd[$key]['help'];

      echo "\n".'<br>Maximum length '.number_format($this->fdd[$key]['maxlen']).' characters';

      echo "\n".'</li></ul>';

   }

   echo "\n".'<p><a href="javascript:history.go(-1)" onmouseover="self.status=document.referrer;return true">Go Back</a></p>';

   echo "\n".'</div>';

   @mysql_close($this->dbh);

   require_once('./inc/footer.php');

   exit;

}


 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov