Forums / Developer / php: change enum value
Sebastian Sprenger
Thursday 19 February 2004 1:36:18 am
Hi all, any idea how to change an enum value via php?I can read the value, but I have no idea how to change it...
Thanks, Sebastian
Bård Farstad
Thursday 19 February 2004 1:43:07 am
It's actually a bit compicated to change the enum values of enum. I would recommend using the ezselection datatype which is a new, simplified and faster implementation of this datatype.
In terms of performance ezselection is also highly recommended.
-bård
Documentation: http://ez.no/doc
Thursday 19 February 2004 2:59:41 am
Sounds good, but I still don't know how to change the value. I suppose it is $selection->setContent() but what kind of parameter do I have to use? Array? I want to select e.g. the second entry. Thanks, Sebastian
Thursday 19 February 2004 3:06:15 am
In the ezselection datatype we just store the id's of the selections in the data_text field as a string. If you have multiple values you need to use a - character as a space. E.g. "1-3" where the id's 1 and 3 are selected.
This can done with the setAttribute( 'data_text', '1-3' );
--bård
Thursday 19 February 2004 4:24:35 am
Oh, yes. Quite simple, it works. Thanks!
liu spider
Thursday 19 February 2004 8:26:43 pm
Could you tell me how I can delete an option in an eZSelection attribute when editing the class in the Admin?
I just can not figure it out.
http://liucougar.scim-im.org SCIM Input Method Platform http://scim.sf.net SJSD Online Editor http://sf.net/projects/sjsd