[Building Sakai] XSD Form Validation: "Value [Ljava.lang.String; @3ee9280f for field XXX must be in enueration"

Noah Botimer botimer at umich.edu
Tue May 31 09:04:12 PDT 2011


Will,

A couple of days behind, but here is a small attempt to help...

This error is thrown when, somehow, you get an HTTP parameter for an item that isn't in the list of acceptable values (i.e., in an xs:enumeration). You seem to have determined that. The trick will be seeing what is submitted and comparing to your expectation.

I would suggest checking, with Firebug or Live HTTP Headers, what is getting POSTed. See if anything strange is coming through for the field (bad values, all empty when minOccurs >= 1, etc.). I don't see anything particularly strange in the XSL below. If there are no clues, let's have a look at the full XSD and XSL off-line.

Thanks,
-Noah

On May 29, 2011, at 8:20 PM, will trillich wrote:

> 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) &lt;= $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!
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110531/c289b8ea/attachment.html 


More information about the sakai-dev mailing list