WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org
View all threadsHi CollectionSpacers,
Do any of you know how to get a field that's a boolean (displayed as a checkbox in the UI) to default to true (checked) in the UI if it's not set? Is there a way to specify a default value for anything besides a pick list? In the app layer, we can specify which option is a default in a set of options, or which value is the default in an enum, but I haven't seen an example of setting a default for any other kinds of fields.
Thanks,
Ray
Hi everyone,
I've found an answer. I did a little digging through the app layer code, and found that you can specify a default for boolean fields like this:
<field id="approvedForWeb" section="pahma" datatype="boolean">
<default>true</default>
</field>
In the default tag, values of "true", "yes", and "1" (case insensitive) are interpreted as true. Anything else is false. The default tag only works for fields with datatype="boolean". It's ignored for other kinds of fields. I'll add this to the cspace-config documentation.
Thanks,
Ray
On Jun 13, 2012, at 12:25 PM, Ray Lee wrote:
Hi CollectionSpacers,
Do any of you know how to get a field that's a boolean (displayed as a checkbox in the UI) to default to true (checked) in the UI if it's not set? Is there a way to specify a default value for anything besides a pick list? In the app layer, we can specify which option is a default in a set of options, or which value is the default in an enum, but I haven't seen an example of setting a default for any other kinds of fields.
Thanks,
Ray
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org