Page 1 of 1
add a new item to a select_list

Posted:
Thu Oct 08, 2009 8:27 am
by entr04y
Is it possible to do this under xataface? For example i have a table which references data in another table by an auto-incremented row id. As an example, let's say I have two tables, the first is cars that have the following:
model
manufacturer_id
color
the second is manufacturers with the following structure:
manufacturer_id
name
in the edit/add new record screen of the cars table I have a dropdown list of the manufacturers. As I'm adding this record of car, I realize that the manufacturer is not listed in the dropdown. Is there a way to have an option to add a manufacturer to that list by just typing it in on the same screen? I don't want to have to switch to a different table view to add a new one then go back and start over on the car screen.
Thanks!

Posted:
Fri Oct 09, 2009 7:42 am
by shannah
There are 2 ways to do this. In 1.2 you can use the lookup widget on your manufacturer id field:
- Code: Select all
[manufacturer_id]
widget:type=lookup
widget:table=manufacturers
Or you could still use a select list widget and add the widget:editvalues option.
e.g.
- Code: Select all
[manufacturer_id]
widget:type=select
vocabulary=myvaluelistofmanufacturers
widget:editvalues=1
The lookup widget is a more elegant solution of the two.

Posted:
Fri Oct 09, 2009 8:22 am
by entr04y
ahh perfect. just what I was looking for. It seems you also need the vocabulary settings for the display window as well.
Is there a place where all of the parameters you can put in the .ini files is completely documented? I haven't found it yet
Thanks!

Posted:
Fri Oct 09, 2009 8:47 am
by shannah
This is as close as it gets:
http://xataface.com/wiki/fields.ini_file
If it is missing something, it is a wiki and you are able to edit it with your forum username and password.

Posted:
Tue Oct 20, 2009 1:51 pm
by conkhikho
Hi Steven,
How about in the case when the manufacturers table has more than one non-id fields, e.g.
Manufacturers
manufacturer_id
Name
Location
Scale
Is there any easy way to add a new manufacturer on the fly?
Thanks
Tim

Posted:
Tue Oct 20, 2009 2:05 pm
by shannah
Use the lookup widget in this case.

Posted:
Fri Oct 23, 2009 11:01 am
by conkhikho
thanks a lot Steve. However, there's a problem with adding new record using the add new button in the lookup window.
After I have added a new record, I am stuck with the add new window, and can't close it. In the end I have to press the browser's refresh button to get rid of it. Is there anything i left out that causes this behavior?
thanks.

Posted:
Mon Oct 26, 2009 2:43 pm
by shannah
Try updating to 1.2.2 (just released today). It makes a number of improvements to the lookup widget that improve the process of adding new records.