[ 
https://issues.apache.org/jira/browse/VELTOOLS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465918
 ] 

Nathan Bubna commented on VELTOOLS-58:
--------------------------------------

Ok.  At this point, i don't see much value in overloading most of the methods 
to take a bundle name as a parameter (as i did in the ValidatorTool.java i 
attached).

So, i've committed Christopher's patch (not sure why i hadn't already done 
that), and i also made another change to support the new feature Niall pointed 
out.  It basically mirrors what was done to the JavascriptValidatorTag in 
Struts revision 289694.

If anyone really wants the functions to have an optional bundle param, let me 
know.  Then i'll check it in, and you can test it for me. :)   If this happens 
after 1.3 is out the door, we can just do a 1.3.1 release.

This is the path of least resistance for me.  Speak now or forever... speak 
later. ;-)

> ValidatorTool does not respect 'bundle' property for message elements when 
> generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: Velocity Tools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / 
> Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>             Fix For: 1.3
>
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple 
> bundles instead of one huge bundle in an effort to maintain some order. This 
> required me to change my validation configuration to include the "bundle" 
> property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" 
> key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I 
> get messages like "The field ???en_US.responseOption.questionTypeId??? is 
> required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and 
> re-uses it for all of the error messages emitted by the javascript generator:
>               String message = Resources.getMessage(messages, locale, va, 
> field);
> In order to respect the <msg>'s bundle, the code should instead be this:
>               String message = Resources.getMessage(app,
>                                                     request,
>                                                     messages,
>                                                     locale,
>                                                     va,
>                                                     field);
> It turns out that this doesn't fix the problem, although I'm sure that this 
> change should be made. Perhaps someone with a better understanding of 
> Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to