add a new item to a select_list

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

add a new item to a select_list

Postby entr04y » Thu Oct 08, 2009 8:27 am

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!
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am

Postby shannah » Fri Oct 09, 2009 7:42 am

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby entr04y » Fri Oct 09, 2009 8:22 am

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!
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am

Postby shannah » Fri Oct 09, 2009 8:47 am

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby conkhikho » Tue Oct 20, 2009 1:51 pm

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
conkhikho
 
Posts: 11
Joined: Wed Oct 07, 2009 5:57 pm

Postby shannah » Tue Oct 20, 2009 2:05 pm

Use the lookup widget in this case.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby conkhikho » Fri Oct 23, 2009 11:01 am

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.
conkhikho
 
Posts: 11
Joined: Wed Oct 07, 2009 5:57 pm

Postby shannah » Mon Oct 26, 2009 2:43 pm

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.
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 11 guests

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