Immutable fields

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

Immutable fields

Postby marksawers » Wed Apr 16, 2008 1:16 pm

I'd like to display fields with immutable values, e.g. a primary key, either as static labels or as a disabled form input element. The widge:type=static shows it as a label, but when I save it complains that the field value is missing. I can't use the widget:atts:style either, as input elements apparently don't take direction on disabled state from style.

Suggestions? Thanks!
marksawers
 
Posts: 7
Joined: Wed Apr 16, 2008 1:09 pm
Location: Fairfield, CT

Postby shannah » Wed Apr 16, 2008 2:02 pm

Best to use parmissions for this.

e.g. if your field name is 'fooID', then define a method in your delegate class:

Code: Select all
function fooID__permissions(&$record){
    return Dataface_PermissionsTool::READ_ONLY();
}
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Immutable fields

Postby marksawers » Wed Apr 16, 2008 2:32 pm

That works for edit but not for add. The field on the create new record form has no input! I guess if my PK was an auto-increment this would work, but in this case it is not.

Any other ideas? Thanks!
marksawers
 
Posts: 7
Joined: Wed Apr 16, 2008 1:09 pm
Location: Fairfield, CT

Postby shannah » Wed Apr 16, 2008 2:36 pm

So you need this field to be editable on ADD but not after it has been added?
Code: Select all
function fooID__permissions(&$record){
    $perms =  Dataface_PermissionsTool::READ_ONLY();
    $perms['new'] = 1;
    return $perms;
}
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 15 guests

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