Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 28. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Multiple select from look-up tables doesn't work

phpMyEdit Configuration     Multiple select from look-up tables doesn't work
Odoslať novú tému   Odpovedať na tému    
 
lemmi     Založený: 23.06.2004   Príspevky: 9  
Príspevok Zaslal: 2004-06-29 19:20
Návrat hore  Odpovedať s citátom     

I try to implement a multiple select from a look-up table, but with no success. Is't a configuration problem or a bug (latest CVS version)??
Here the code:

Kód:
$opts['fdd']['Comp_Category'] = array(
  'name'     => 'Cat.',
  'select'   => 'M',
  'maxlen'   => '50',
  'options'  => 'LVACP',
  'sort'     => true
);
$opts['fdd']['Comp_Category']['values']['table'] = 'tblcompany_section';
$opts['fdd']['Comp_Category']['values']['column'] = 'Cat_ID';
$opts['fdd']['Comp_Category']['values']['description'] = 'Name';


I always get a standard select box on an the Add/Change screen but a multiple select for filtering.
What is wrong?

Thanks for help!!!

 
lemmi     Založený: 23.06.2004   Príspevky: 9  
Príspevok Zaslal: 2004-06-30 09:43
Návrat hore  Odpovedať s citátom     

Problem resolved!!

I have just added following code to function recreate_displayed() as proposed by hbernard:

Kód:
//<hbernard - Line 2650 - add this lines to make 'M'ultiple work with ['values']['table']
            if ($this->fdd[$key]['select'] == 'M' &&   isset($this->fdd[$key]['values']['table'])) {
            $this->connect(); //connection to mysql, required for set_values_from....
            $this->fdd[$key]['values2'] = (array)$this->fdd[$key]['values2']
            + (array)$this->set_values_from_table($key);
            unset($this->fdd[$key]['values']); //useless values
            }
//>hbernard


That's all. It works as expected.

 
fgalian     Založený: 08.07.2009   Príspevky: 2  
Príspevok Zaslal: 2009-07-08 08:50
Návrat hore  Odpovedať s citátom     

Hello, it seems that line 2650 reffers to an older source code. Could you please let me know where should I insert this code and if it still works with phpMyEdit/phpMyEdit.class.php,v 1.204 2007-09-16 12:57:07 ?? thanks in advance,

Franco

lemmi Napísal:
Problem resolved!!

I have just added following code to function recreate_displayed() as proposed by hbernard:

Kód:
//<hbernard - Line 2650 - add this lines to make 'M'ultiple work with ['values']['table']
            if ($this->fdd[$key]['select'] == 'M' &&   isset($this->fdd[$key]['values']['table'])) {
            $this->connect(); //connection to mysql, required for set_values_from....
            $this->fdd[$key]['values2'] = (array)$this->fdd[$key]['values2']
            + (array)$this->set_values_from_table($key);
            unset($this->fdd[$key]['values']); //useless values
            }
//>hbernard


That's all. It works as expected.


 
JammerPro     Založený: 07.12.2006   Príspevky: 33  
Príspevok Zaslal: 2009-10-02 22:31
Návrat hore  Odpovedať s citátom     

fgalian Napísal:
Hello, it seems that line 2650 reffers to an older source code. Could you please let me know where should I insert this code and if it still works with phpMyEdit/phpMyEdit.class.php,v 1.204 2007-09-16 12:57:07 ?? thanks in advance,

Franco

lemmi Napísal:
Problem resolved!!

I have just added following code to function recreate_displayed() as proposed by hbernard:

Kód:
//<hbernard - Line 2650 - add this lines to make 'M'ultiple work with ['values']['table']
            if ($this->fdd[$key]['select'] == 'M' &&   isset($this->fdd[$key]['values']['table'])) {
            $this->connect(); //connection to mysql, required for set_values_from....
            $this->fdd[$key]['values2'] = (array)$this->fdd[$key]['values2']
            + (array)$this->set_values_from_table($key);
            unset($this->fdd[$key]['values']); //useless values
            }
//>hbernard


That's all. It works as expected.


It works in 5.7.1 perfectly!

Insert the above code at Line 2980. Here's where:

Kód:

if (is_array(@$this->fdd[$key]['values']) && ! isset($this->fdd[$key]['values']['table'])) {
            foreach ($this->fdd[$key]['values'] as $val) {
               $this->fdd[$key]['values2'][$val] = $val;
            }
            unset($this->fdd[$key]['values']);
         }

// [b]THIS IS LINE 2980 in Version 5.7.1 - Put the above code here!!!!![/b] Like this:

//<hbernard - Line 2650 - add this lines to make 'M'ultiple work with ['values']['table']
            if ($this->fdd[$key]['select'] == 'M' &&   isset($this->fdd[$key]['values']['table'])) {
            $this->connect(); //connection to mysql, required for set_values_from....
            $this->fdd[$key]['values2'] = (array)$this->fdd[$key]['values2']
            + (array)$this->set_values_from_table($key);
            unset($this->fdd[$key]['values']); //useless values
            }
//>hbernard

         isset($this->fdd[$key]['help']) && $this->guidance = true;
         $this->fdd[$field_num] = $this->fdd[$key];
         $field_num++;


 
sbuelow     Založený: 10.07.2009   Príspevky: 6  
Príspevok Zaslal: 2011-01-10 11:31
Návrat hore  Odpovedať s citátom     

Hello there
Just had the same issue and applied the patch as suggested by hbernard on 5.7.1.
There's still a flaw tough.
Look like data is saved correctly, but when I edit the record, previously selected values don't get highlighted again.
The same doesn't happen with 5.6 release.

Anybody knows where to look for ?

Thanks

 
ddgiants     Založený: 15.12.2011   Príspevky: 1  
Príspevok Zaslal: 2011-12-15 23:18
Návrat hore  Odpovedať s citátom     

I know this is old but just for any Googlers like me.
For 5.7.1 add above aforementioned code after line 2979.

However, to get it to choose previous selected items in update mode, you need to change this line at line 1539
foreach($selected as $val) $selecte2[]=(string)$val;
to this
foreach($selected as $val) $selected2[]=(string)$val;
Notice the missing d. All works great now, Thanks forum.

DD

sbuelow Napísal:
Hello there
Just had the same issue and applied the patch as suggested by hbernard on 5.7.1.
There's still a flaw tough.
Look like data is saved correctly, but when I edit the record, previously selected values don't get highlighted again.
The same doesn't happen with 5.6 release.

Anybody knows where to look for ?

Thanks


 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2015-01-16 16:06
Návrat hore  Odpovedať s citátom     

http://hockinson.us/txt/num_recs.txt

 
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