DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30846>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30846

Validator framework does not properly display messages

           Summary: Validator framework does not properly display messages
           Product: Struts
           Version: 1.1 Final
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am using indexed fields and the validator framework to validate them.  I find 
that both client and server side validation messages appear with the name of 
the invalid field missing (e.g., "   is required" or "  is not a valid email 
format").  This appears to happen for indexed fields only.  These fields appear 
in the .JSP as:


        <logic:iterate id="contacts" name="DrInventoryForm" property="contacts" 
type="gov.nih.nci.prpse.pojo.Contact" indexId="ctr">
                                                                                
        <b>Name <%= ctr.intValue() + 1 %>:</b><% if (ctr.intValue() == 0) { %
><span class="alert">*</span><% } else { %>&nbsp;&nbsp;<% } %
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                                
        <html:text name="contacts" property="name"  indexed="true" 
styleId="contacts" maxlength="200" size="65" onchange="<%= "toggleVisibility
('cntct" + (ctr.intValue() + 1) + "', true);" %>" />
        <b>Email <%= ctr.intValue() + 1 %>:</b><% if (ctr.intValue() == 0) { %
><span class="alert">*</span><% } else { %>&nbsp;&nbsp;<% } %
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <html:text name="contacts" property="email"  indexed="true" 
styleId="contacts" maxlength="200" size="65" onchange="<%= "toggleVisibility
('cntct" + (ctr.intValue() + 1) + "', true);" %>" />
</logic:iterate>

The corresponding validator lines are:

   <field property="contacts[1].name" depends="maxlength">
      <arg0 key="drinventoryform.contacts[1].name"/>
      <arg1 key="${var:maxlength}" resource="false" />
      <var>
      <var-name>maxlength</var-name>
      <var-value>200</var-value>
      </var>
    </field>
    <field property="contacts[1].email" depends="email,maxlength">
      <arg0 key="drinventoryform.contacts[1].email"/>
      <arg1 key="${var:maxlength}" resource="false" />
      <var>
      <var-name>maxlength</var-name>
      <var-value>200</var-value>
      </var>
    </field>



and finally, the lines as they appear in the html are:

<div id="cntct0" style="display:block">
<input type="hidden" name="contacts[0].id" value="" id="contacts">
<b>Name 1:</b><span class="alert">*</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="contacts[0].name" maxlength="200" size="65" value="" 
onchange="toggleVisibility('cntct1', true);" id="contacts">
<b>Email 1:</b><span class="alert">*</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="contacts[0].email" maxlength="200" size="65" value="" 
onchange="toggleVisibility('cntct1', true);" id="contacts">
</div>



The lines in the HTML generated from the validation framework are:


    function maxlength () { 
     this.aa = new Array("contacts[0].name", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));
     this.ab = new Array("contacts[0].email", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));
     this.ac = new Array("contacts[1].name", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));
     this.ad = new Array("contacts[1].email", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));
     this.ae = new Array("contacts[2].name", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));
     this.af = new Array("contacts[2].email", " can not be greater than 200 
characters.", new Function ("varName", "this.maxlength='200';  return this
[varName];"));


NOTE THE MISSING NAMES.  These same errant messages appear both on client and 
server side validation.

thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to