Turn off editing of a field

Archived from the Xataface Users forum.

jimr451 — Mon May 14, 2012 11:24 am

Hi,

I have a field that I’d like to “lock” once the record is created. It’s a “username” field, and I’d like to not allow editing it once the record is created. I tried setting permissions, to no avail - is there a simple way to turn off editing of the field once the record is not new. Again, I tried all kinds of things from the manual, but nothing seemed to take.

-Jim


Jean — Tue May 15, 2012 1:06 am

Hi Jim,

This is described in http://xataface.com/wiki/fieldname__permissions

Have a good day

Jean


jimr451 — Tue May 15, 2012 7:04 am

Wow - I swear I tried that (and a bunch of other combinations) to no avail - but now it works:

In the delegate class:

Code: Select all
function username__permissions(&$record) {      return array('edit'=>0);   }

turns off editing for the username field after the record has been created.

I wonder if something was cached somewhere, or I was testing too many things at the same time.

Thanks!


Jean — Tue May 15, 2012 7:09 am

Jim,
It happens often when we have your head in our code

Jean