Cascading dropdown or list

Status
Not open for further replies.

madpato

Member
Hello

I am posting again here hoping to get better directions to achieve what i need, i will explain everything again (posted on standard support first).

I have to construct an application who bassically needs to achieve 2 things (There is more to be done but this is like the core of my problem, if i figure this out i can then start to work with the rest on my own):

- Creates an entry for a customer (with all his data, name, address, etc.) No big deal here, i got that working.
- Adds its yearly and monthly sales (and some other data but lets just stick with his sales). HERE is my problem:

The time dimension is what i need to think about, now sophist told me:

I would use a repeat group for each year with a year field and 12 fields for the months.

This will allow me to achieve the following?:
When i create a new record, (a new sales period of a customer) i need to select a year then the month (cascading dropdown maybe?) because i will need to input data on (for example) year: 2010 month: march. So after i select those 2 options then i will be presented with the fields corresponding to that time reference.

Please bear with me i am no fabrik expert, any extra info you need i will gladly provide it.
Thank you for your time :)
 
Hi

then i will be presented with the fields corresponding to that time reference.
Do the fields change depending on the year/month selected? I would imagine not, but I'd like to be sure.

If not then this is the standard procedure for creating a list with a repeat group which will allow you to add line items.
  • Create a new list 'customer_sales'
  • To this list's group, add a new database join element 'customer' which allows you to select a customer from the customer list.
  • Create a new group 'customer_sales_items', assign it to the 'customer_sales' form and set it to be a repeatable group (I think you might need to save the group before this option becomes available)
  • Set the repeat group "repeat->template" option to be "table" to render the repeating group as a <table> where each additionally added repeat group is a row in that table.
  • Add two dropdown elements to the 'customer_sales_items' group for 'year' and 'month'
  • To both of these element's I would add a "not empty" validation - to ensure that each repeat group added contained a year and month entry.
  • Add in any other elements (such as 'sales_value') to the repeat group.
I wouldn't worry about showing/hiding elements at this stage, what is important is that you get the data structure right - and the validations on the month/year will mean that only complete entries will be entered when the form is saved.
 
Hello Rob

The fields on the same form do not change if you mean by that if i select a year/month i will get an element A or element B the fields are the same but they need to be recorded for each year and month on its own. For example sales amount for january 2010 and january 2011, same field different time.

As for what you suggest i will try it, thank you!
 
Hello Rob

I am hitting a problem related to this, turns out i created another repeatable group but now i need to "call" the options on the group, so here an example:

- I have a list with a field named "proyect" who has a repeatable group part (just like you showed me how to do it) called "generation"with some other data
- In my customer list i need to call this proyect field but since it has a repeatable group with several options i need to be able to filter those options.
- So if i pick "proyect A" (did it with a databasejoin) then on my next field (cascading dropdown probably?) called generation it should show me the options of the group (like gen A, gen B, etc.). THIS is the part i cannot achieve

Can you please guide me here? thank you.
 
hi could you provide the site information here http://fabrikar.com/you/my-sites/ (only staff can see this) and let us know which forms/lists/elements are involved in this issue.

I'm not sure what you mean by "In my customer list i need to call this project" and how that related to filtering the repeat group options, but maybe looking at the form itself will help me understand.

I think that the answer as you say is probably to add a cascading dropdown but I'd like to see the form first before committing to a reply.

-Rob
 
Hello

The project is a field on my customer list which via a databasejoin element calls the data on my other list (called projects in spanish proyectos).



I have already submitted the info you told me. Thanks.
 
Hi Sorry to be difficult, but could you re-supply your problem, giving the list names and field names that are on your site. I'm struggling with the spanish to understand the set up compared to your description.
 
Ok let me explain better:

I have a list called "proyectos" in here i have an element called "nombre_proyecto" and also a repeat group called "generaciones" what i need to do is this:

I need to show in my "emprendedores" list here: http://desarrollo.tilatam.com/tns/index.php/ingreso-de-datos/emprendedores the project where they belong (see column proyecto) my problem is that i ALSO need to show to what "generacion" they belong (the repeating group). And i cant achieve that.
So in my emprendedores form i need to select the proyecto and afterwards the generacion to where they belong (and since a proyecto has its own generaciones i need those options change as needed).

I hope i have made it more clearer to you. Thanks.
 
great thanks! that made it clear to me.
First of all there had to be a fabrik list pointing to the database table which stores the data for the "Proyectos - generations repeat group", I've made that for you - its called 'generations'

Then I edited the cascadingdropdown you already had in the 'Emprendedores' form. I set it to look up date in the generations list and observe the changes in the Proyecto element

However, your site seems to be missing two files, which were causing js errors, and thus the cdd element was not working, so I have temporarily unpublished the two display elements in the form "Datos Personales" and "Datos del Proyecto".

You should get the files from github for plugins/fabrik_element/display/display.js and display-min.js and put them on your site, then you can re-publish those two display elements.
 
Thanks Rob that did it, now another question
Is it possible to change the database table for example i have tns_proyectos_23_repeat is there a way that i can change the name for something like tns_proyectos_generaciones (which is the list named generaciones) so its easier to make a reference to it?

Thank you.
 
not from within fabrik, you could change it in phpmyadmin, and then ensure that any reference made to it in the tables #__fabrik_joins, #__fabrik_elements and #__fabrik_lists are updated.

Generally if possible its best to create all the lists to start off with, then join them, that way Fabrik doesn't need to assign table names which are not that human readable.
 
If you do change the name in those Fabrik tables, I strongly suggest you do a full database backup first, as there is a lot of scope for hosing things up when you start poking around changing things by hand in our metadata tables.

-- hugh
 
Thanks so i first have to plan the lists in order to prevent fabrik from giving random name to those lists. Thanks.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top