Lookup fields

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

Lookup fields

Postby fredo2906 » Mon Nov 26, 2012 11:14 pm

Hi,
If I post this message at the wrong place, please let me know.

I would like to let a user select a record from a table A and save the id into another table.

I set the following in fields.ini file for the table Servers_has_Alarms :
[Servers_id]
widget:type=lookup
widget:table=Servers

The table into which i want to insert a record is :
Servers_has_Alarms
contains a field Servers_id

The box does not return the id of the selected record, which means the insert fail at the end.

Any idea?
fredo2906
 
Posts: 3
Joined: Mon Nov 26, 2012 10:57 pm

Re: Lookup fields

Postby fredo2906 » Tue Nov 27, 2012 12:48 am

Let me know if you want some clarification. :D
fredo2906
 
Posts: 3
Joined: Mon Nov 26, 2012 10:57 pm

Re: Lookup fields (Solved)

Postby fredo2906 » Tue Nov 27, 2012 1:08 am

I found the solution.
Create a delegate class mytable.php.
use the beforeSave trigger
Get the output from $record->value('myfield')
and ... get the ID from the returned value, and use $record->setValue to set the field with the good id.

Hope this will help someone else.
fredo2906
 
Posts: 3
Joined: Mon Nov 26, 2012 10:57 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 1 guest

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