| Index
» Projects
» phpMyEdit
» Forum
» help me please: cant filter subcategories in second lookup |
 |
luxigo
Joined: 01 Oct 2009
Posts: 3
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)
Posted: 2009-10-01 16:21
Back to top
Reply with quote
|
No.
|
luxigo
Joined: 01 Oct 2009
Posts: 3
Posted: 2009-10-01 17:29
Back to top
Reply with quote
|
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
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
|
|
|
|