Checkboxes and Many-to-Many Relationships

A place for users and developers of the Xataface to discuss and receive support.

Postby cls » Thu Sep 14, 2006 7:25 pm

Hi all,
hi Steve,

Dataface is a very great tool, I discovered it yesterday and now I'm setting up the backend for a website I'm developing.
I'll try to be brief, but I'm afraid that the question is quite complex... sorry.

The question is: it is possible to have an Add/Edit form with a set of checkboxes related to the records contained in another table?
For example, I have 2 tables: "Articles" and "Categories". Every article can be associated to one or more categories. So, when I insert a new article, I would like to have a checkbox for each item of the Categories table.
I imagine I need a join table, like "Article2Category" where relationships are stored, and I tried also the examples in the documentation Example 2 (Relationships Sections), but unfortunately it doesn't work.

There is a way to get this, or is this a feature not yet supported?

Thanks in advance,
Claudio
cls
 
Posts: 15
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Sep 14, 2006 9:59 pm

Hi Claudio,

Thanks for trying Dataface and thanks for the question.

Currently this is a point of difficulty... but it is VERY close to being addressed. For now you can sort of do this, but not in the best way, unfortunately.

It is possible to set up a "repeat" field so that the field can store multiple values (one per line). This can simulate what you are looking for as follows:

Add a varchar or text field to the Articles table called 'categories'.
e.g.
categories varchar(32)

In the Articles fields.ini file:

[categories]
widget:type = checkbox
vocabulary = categories

And in the valuelists.ini file:

[categories]
__sql__ = "select category_id, category_name from Categories"

This would result in a set of checkboxes representing the categories in the Categories table to be displayed on the Article form.

Does this suffice?

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby cls » Fri Sep 15, 2006 2:14 am

Thanks Steve for your answer.

The final goal for me is to make in the front end a search form (or query-based pages) where I can display Articles related to a given Category. It's a simple thing to do also with the simulation you suggested, so I think that I can use this solution, until the feature will be addressed (how long we have to wait?) :)

Thanks and again: Dataface is very useful.

Bye,
Claudio
cls
 
Posts: 15
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Sep 15, 2006 8:57 am

until the feature will be addressed (how long we have to wait?) <img src=:)" title="Smile" />



I would expect this to be implemented by the end of the year.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 28 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved