Page 1 of 1

Turn off editing of a field

PostPosted: Mon May 14, 2012 11:24 am
by jimr451
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

Re: Turn off editing of a field

PostPosted: Tue May 15, 2012 1:06 am
by Jean
Hi Jim,

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

Have a good day

Jean

Re: Turn off editing of a field

PostPosted: Tue May 15, 2012 7:04 am
by jimr451
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!

Re: Turn off editing of a field

PostPosted: Tue May 15, 2012 7:09 am
by Jean
Jim,
It happens often when we have your head in our code :wink:

Jean