Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  help me please: cant filter subcategories in second lookup

phpMyEdit General     help me please: cant filter subcategories in second lookup
Post new topic   Reply to topic    
 
luxigo     Joined: 01 Oct 2009   Posts: 3  
Post Posted: 2009-10-01 11:53
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-10-01 16:21
Back to top  Reply with quote     

No.

 
luxigo     Joined: 01 Oct 2009   Posts: 3  
Post Posted: 2009-10-01 17:29
Back to top  Reply with quote     

doug wrote:
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     Joined: 01 Oct 2009   Posts: 3  
Post Posted: 2009-10-02 03:29
Back to top  Reply with quote     

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

Code:
--- 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:

Code:
<?php

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


Thanks :)

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy