restrict related record
Archived from the Xataface Users forum.
cookie720 — Tue Jun 19, 2012 9:33 pm
Hi all,
Hopefully my last question for a while (not likely though )
I need to restrict clients in my orders, ONE client per order,
When looking up related records in my orders, in my clients tab, I want to disable that add new clients record button. If not then upon creating the record, disallow it.
Im guessing a function in my delegate class, something to do with triggers, beforesave, or beforeAddRelatedRecord?
Ill have a go:
- Code: Select all
function beforeInsert(&$record){ $response =& Dataface_Application::getResponse(); if ( there is no record ){ insert client } else { return PEAR::raiseError( "Cannot have more than one client per Order. Record could not be inserted", DATAFACE_E_NOTICE); } }
Thanks!
shannah — Wed Jun 20, 2012 10:20 am
Hard to comment as I don’t know how you are adding the clients. Using the grid widget on the new record form, or adding clients individually with the add related record form?
cookie720 — Thu Jun 21, 2012 5:00 am
Yes the add related record