Grouping Checkboxes?
Archived from the Xataface Users forum.
egonux — Mon May 14, 2012 5:56 am
Hi Steve,
first of all, thanks for your great application!
Background:
Right now, I’m working on a slightly elaborated library system with Xataface and I could find nearly everthing in the Wiki or Forum, but now I could need some help:
I’ve got a table with publications (the main table), and beside some others, a table with categories and a table with catchphrases, they look like
[publications]
id … catchphrase_id
[categories]
id name
[catchphrases]
id name category_id
Problem:
I’ve got 690 catchphrases sorted in 16 categories and i would like to group them. Means, if I create a new record, I would like to
1st: select one or more categories
2nd: select one or more catchphrases from these categories.
Could you give me a hint on how i could achieve this?
Thank you very much & best regards
Axel
shannah — Tue May 15, 2012 9:56 am
You’ll need to do something with Javascript here.
First, if you add a third column to the select of the catchphrases valuelist __sql__ query, where this third column identifies which category the catchphrase is associated with, then you’ll see that this value is added as a CSS class to the checkbox corresponding to that catchphrase.
Then you can use javascript to show or hide catchphrase checkboxes depending on which categories are selected. Wrap this in a javascript function and add it to both the document’s ready event and the change event of the category checkboxes.
-Steve
egonux — Tue May 29, 2012 3:53 am
Hi Steve,
thanks to your reply.
I’m not too familiar with Javascript, so could you help me with this (on account)?
Best regards
Axel