one to one relationship - how to disable add related record

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

one to one relationship - how to disable add related record

Postby razzetto » Mon Sep 17, 2012 8:03 pm

Hi Steve.

i'm trying to solve this situation:

i have a one to one relationship between two tables (and, unfortunately, i can't just merge them into one big table).

the relationships.ini file in the source table folder (folder named utenti) is like this:

Code: Select all
[situazione_personale]
situazione_personale.id_utente = "$id_utente"


the destination table, situazione_personale, has only id_utente as a key, so every utente (i.e. 'utenti'.'id_utente' )can have just one related record in the destination table.

now.. my question is.. is it possible to disable the add new related record action if one related record already exists?

with the current behaviour, users can try to add a second record (and xataface tells Record successfully added to situazione_personale relationship.).
Of course, no record is actually added, but it seems to me it's a little confusing (people trying to add a new record, even if not possible, getting the success message and then not seeing the record).

perhaps.. is there a better way to write the relationship? or better to disable the action if there's already a related record?

Thanks,

Paolo
razzetto
 
Posts: 16
Joined: Thu Jul 12, 2012 6:58 pm

Re: one to one relationship - how to disable add related rec

Postby shannah » Mon Sep 24, 2012 9:27 am

Add the
Code: Select all
actions:addnew=0

directive to your relationship definition.

http://xataface.com/wiki/relationships.ini_file

-Steve
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 23 guests

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