Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 24. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Return to record after error on update/insert

phpMyEdit Configuration     Return to record after error on update/insert
Odoslať novú tému   Odpovedať na tému    
 
BrianJ     Založený: 17.10.2011   Príspevky: 2  
Príspevok Zaslal: 2011-10-17 16:00
Návrat hore  Odpovedať s citátom     

I am trying to return to the data the user was updating/inserting after an error - duplicate entry in a field error. No matter what I try, it always returns to an empty form. I tried using some code I found here to go back, but then I get an error saying the web page has expired, etc. Even if I go ahead and re-post, there is no data. I have a trigger so I can look it up before it gets added, but I still am not sure how to return to the form with the data intact and a message at the top. Any suggestions? Thanks!

Brian.

 
BrianJ     Založený: 17.10.2011   Príspevky: 2  
Príspevok Zaslal: 2011-10-17 16:15
Návrat hore  Odpovedať s citátom     

Ok, so I found another message which partially solved my issue for an update. This thread http://opensource.platon.sk/forum/projects/viewtopic.php?t=60517 shows how to return to a record - the changes have all been lost, but at least it is back to the correct record. It would be great to be able to return to the previous form with the data there for an insert or update.

Brian.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2011-10-18 14:02
Návrat hore  Odpovedať s citátom     

The following clips may be problematic, I haven't used them much, and may not work in the event Javascript 'required' is true.

Kód:
// view after insert
if($_POST['PME_sys_saveadd'] == 'Save' || $_POST['PME_sys_savechange'] == 'Save' || $_POST['PME_sys_savechange'] == 'Submit'){

   $PME_sys_operation = 'PME_op_View';

   $PME_sys_rec = $_POST['PME_sys_rec'];

   $this->operation = 'View';

}


Kód:
// view after update

$this->rec = $this->key;

$this->operation = $this->labels['View'];

$this->recreate_fdd();

$this->recreate_displayed();


 
itmachines     Založený: 26.07.2012   Príspevky: 1  
Príspevok Zaslal: 2012-07-26 23:53
Návrat hore  Odpovedať s citátom     

Hi,

I was able to acheive this, and as this was not a solution (now in 2012) when was looking for it, I add it here in case some one else comes up with this issue...


In the trigger file, I added the following when the trigger was cancelling the save...

Kód:
if (!$return_value)
{
    //Change view back to change mode...
    $this->operation = $this->labels['Change'];
   
    //This column has different values in list mode,
    // and needed to be set back to a drop down
    // with values from another table
    $this->fdd['product_id']['select'] = 'D';
    $this->fdd['product_id']['values']['table']       = 'products';
    $this->fdd['product_id']['values']['column']      = 'id';
    $this->fdd['product_id']['values']['description'] = 'name';
   
    //This is the column that I re-populated with
    // the previous value, as you see, its simply
    // ignoring the value in the DB, and putting
    // in the posted variable :)
    $this->fdd['size']['sql'] = 'TRIM("'.$newvals['size'].'")';

    $this->recreate_displayed();
}



Hope it helps![/code]

 
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