[ 
https://issues.apache.org/struts/browse/WW-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43375#action_43375
 ] 

Benjamin McCann commented on WW-2256:
-------------------------------------

This issue arises in Firefox using the Dojo plugin (possibly other cases too, 
but this is the one I'm aware of.)
Firefox for some reason inserts an extra span element (viewable with Firebug) 
making the current implementation break.  The patch fixes the issue by not 
assuming it needs to go up a fixed two parent levels, but instead figures that 
out dynamically.
I changed the labels errorFor to reference elements by name instead of id 
because there were instances in which Struts was generating a name, but not an 
id.  I didn't see any cases where it was the other way around, which makes some 
sense because you only need the name attribute defined to submit data.  The 
validation code was broken for those instances where an id was not generated by 
Struts, so this patch solves that issue as well.  I made it a single patch 
because this is everything needed to get validation working with the Dojo 
plugin.
I'm not sure if there's a good way to unit test JS.  I suppose we could look at 
HtmlUnit.  I've been using a patched version of Struts with this and several 
other bug fixes I wrote in an enterprise environment with thousands of users 
for the last few months with no issues.
Also, yes, consider only the larger patch.  The smaller patch fixes only a 
subset of the issues (adding errors, but not clearing them)

> Validation broken on autocompleters
> -----------------------------------
>
>                 Key: WW-2256
>                 URL: https://issues.apache.org/struts/browse/WW-2256
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Mechanism, Plugin - Tags
>    Affects Versions: 2.0.9, 2.1.0
>         Environment: Issue identified on Windows XP using Firefox
>            Reporter: Benjamin McCann
>            Priority: Critical
>             Fix For: 2.1.4
>
>         Attachments: allFieldsFilledOnSubmit.png, siteEmptyOnSubmit.png, 
> validation.js.patch, validation.js.patch
>
>
> I have an autocompleter named "site":
> <s:url id="siteList" action="AutocompleteField" method="selectSite" 
> namespace="/general" />
> <sx:autocompleter label="Site" value="%{system.site}"
>       forceValidOption="true"
>       cssStyle="width:132px; height:18px; border:1px solid #7B9EBD"
>       name="site" required="true" href="%{siteList}"
>       loadOnTextChange="true" showDownArrow="false" dropdownWidth="300"
>       searchType="substring" />
> It has the following validator:
> <field name="site">
>     <field-validator type="requiredstring">
>         <message>Field is required</message>
>     </field-validator>
> </field>
> When I submit my .jsp without site filled in I get the message: "TypeError: 
> row.cells has no properties"
> When I submit my .jsp with site filled in I get message that the field is 
> required and all the other fields are blanked out.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to