⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

gc_dependent_select library with condition



carperolm
  • profile picture
  • Member

Posted 10 February 2016 - 12:39 PM

Hello

For dependent dropdowns I use gc_dependet_select library by Victor (amazing library)

 

But I'm not sure if I can do the following:

 

I have this database structure:

COUPONS
coupon_id
user_id
category_id
...

USERS
user_id
city_id
...

CATEGORIES
category_id
city_id
...
$fields = array(
// first field:
'user_id' => array( // first dropdown name
'table_name' => 'users', // table of country
'title' => 'username', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'category_id' => array( // second dropdown name
'table_name' => 'categories', // table of state
'title' => 'name', // state title
'id_field' => 'category_id', // table of state: primary key
'relate' => 'city_id', // table of state:
'data-placeholder' => 'Select users first' //dropdown's data-placeholder:
)
);

 

I would like to generate a dependant dropdown in COUPONS, where I select the users first and then the categories with the same city_id as the user selected.

 

It's possible?

 

Thanks in advance

 


darkweather
  • profile picture
  • Member

Posted 23 February 2016 - 08:30 AM

Is gc_dependet_select library by Victor works for current version of grocery? 

 

I've been trying to implement it recently but I couldn't make it work.

On last pages of main topic it said that is not working with current of grocery.

 

Is there any particular trick?

 

Thank you


carperolm
  • profile picture
  • Member

Posted 25 February 2016 - 15:27 PM

It's working properly with the last grocerycrud version.

 

I just follow the steps.