Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  help me please: cant filter subcategories in second lookup

phpMyEdit General     help me please: cant filter subcategories in second lookup
Odoslať novú tému   Odpovedať na tému    
 
luxigo     Založený: 01.10.2009   Príspevky: 3  
Príspevok Zaslal: 2009-10-01 11:53
Návrat hore  Odpovedať s citátom     

Hello,

I need to restrict subcategories values listed in the second <select> using the category selected in the first one,

but i cant find how to specify the category in the filter

Obviously the second <select> must be regenerated when the value the first one is changed

Is there a way to achieve this ?

$opts['fdd']['category']['values']['table']='categories';
$opts['fdd']['category']['values']['column']='category';
$opts['fdd']['category']['values']['description']='label';

$opts['fdd']['subcategory']['values']['table']='subcategories';
$opts['fdd']['subcategory']['values']['column']='subcategory';
$opts['fdd']['subcategory']['values']['description']='label';
$opts['fdd']['subcategory']['values']['filters']='category = ???????????';

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

No.

 
luxigo     Založený: 01.10.2009   Príspevky: 3  
Príspevok Zaslal: 2009-10-01 17:29
Návrat hore  Odpovedať s citátom     

doug Napísal:
No.


Without using phpMyEdit i can create a hidden <div> per category, containing a <select> for the related subcategories,

Plus one visible <div> for the current category, and use javascript to replace the content of the visible one when a category is selected.

Maybe it is possible to implement something like this using insert and update triggers ?

Just dont say 'no' :)

 
luxigo     Založený: 01.10.2009   Príspevky: 3  
Príspevok Zaslal: 2009-10-02 03:29
Návrat hore  Odpovedať s citátom     

I patched phpMyEdit so that i can define 'post' insert and update triggers.

Kód:
--- phpMyEdit-5.7.1/phpMyEdit.class.php.orig    2007-09-16 15:00:56.000000000 +0000
+++ phpMyEdit-5.7.1/phpMyEdit.class.php 2009-10-02 01:56:40.441248137 +0000
@@ -2570,6 +2570,14 @@
                $this->display_record_buttons('down');

                $this->form_end();
+
+               if ($this->change_operation()) {
+                       $ret &= $this->exec_triggers_simple('update', 'post');
+               }
+               if ($this->add_operation() || $this->copy_operation()) {
+                       $ret &= $this->exec_triggers_simple('insert', 'post');
+               }
+
        } /* }}} */

        /*


Then it is possible to use something like this in the include file:

Kód:
<?php

  echo '
        <script>
                attr=document.createAttribute("onChange");
                attr.nodeValue="javascript:subcategories_update();";
                document.getElementsByName("PME_data_category")[0].setAttributeNode(attr);
        </script>
  ';
?>


Thanks :)

 
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