[Building Sakai] XSD Form Validation: "Value [Ljava.lang.String; @3ee9280f for field XXX must be in enueration"
will trillich
will.trillich at serensoft.com
Sun May 29 17:20:54 PDT 2011
Short version:
The error message is "*Value [Ljava.lang.String;@3ee9280f for field XXX must
be in enueration*" and it happens when we try to submit a form that has a
checkbox-group. Any ideas what that means and/or how to get past it?
Long version:
We're trying to use a custom XSL field-renderer to produce the create-form
HTML by modifying/overriding <xsl:template name="select-field">:
The field will be specified in XSD as an
<xs:element><xs:simpleType><xs:restriction base="string"> with a bunch of
<xs:enumeration> values inside it. Each such value is to be a checkbox
instead of a radio box. To facilitate this we've opted to allow the XSD to
include an extra element *<xs:documentation source="toggles" /> *that will
'trigger' the checkbox-group.
The 'canned' version from formFieldTemplate.xslt includes this test:
<xsl:when test="@maxOccurs !='1' and
count($currentSchemaNode/xs:simpleType/xs:restriction[@base='xs:string']/xs:enumeration)
<= $htmldeterm">
and when that's true, the checkbox-group code that we want to run gets
executed. But that only runs when maxOccurs isn't 1 and the number of
enumerated values <= 2. We want it to run when the "toggles" source is
specified in the XSD, so we copied the code up to the top of the
<xsl:choose> statement and made this the first test:
<xsl:choose>
<xsl:when test="*
$currentSchemaNode/xs:annotation/xs:documentation[@source='toggles']*">
<!-- this will force a checkbox group control -->
<fieldset>
<xsl:attribute name="class">
<xsl:text>serensoft-toggles </xsl:text>
<xsl:call-template name="fieldClass">
<xsl:with-param name="schemaNode"
select="$currentSchemaNode" />
<xsl:with-param name="baseType"
select="'osp-radcheck'" />
</xsl:call-template>
</xsl:attribute>
<legend>
<xsl:if test="$currentSchemaNode/@minOccurs='1'">
<span class="reqStar">*</span>
</xsl:if>
<xsl:call-template name="produce-label">
<xsl:with-param name="currentSchemaNode"
select="$currentSchemaNode" />
</xsl:call-template>
</legend>
<xsl:for-each
select="$currentSchemaNode/xs:simpleType/xs:restriction[@base='xs:string']/xs:enumeration">
<div class="checkbox">
<input id="{$name}-{position()}"
name="{$name}-{position()}" type="checkbox">
<xsl:attribute name="onChange">
(this.checked==true) ?
document.getElementById('<xsl:value-of select="$name" />-<xsl:value-of
select="position()" />-w').value='<xsl:value-of select="@value" />'
: document.getElementById('<xsl:value-of
select="$name" />-<xsl:value-of select="position()"
/>-w').value=''</xsl:attribute>
<xsl:if test="$currentNode = @value">
<xsl:attribute
name="checked">checked</xsl:attribute>
</xsl:if>
</input>
<label for="{$name}-{position()}">
<xsl:value-of select="@value" />
</label>
<input type="hidden">
<xsl:attribute name="name">
<xsl:value-of select="$name" />
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of
select="concat($name,'-',position(),'-w')" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:if test="$currentNode = @value">
<xsl:value-of select="@value" />
</xsl:if>
</xsl:attribute>
</input>
</div>
</xsl:for-each>
</fieldset>
</xsl:when>
Any ideas what the form-validator is really complaining about?
This is in Sakai v2.7.1.
--
"The Fed is still under the assumption all they have to do to revive an
economy is blow a new bubble" -- Josh Rosner. Amen!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110529/d482a4c5/attachment.html
More information about the sakai-dev
mailing list