[ 
http://mifosforge.jira.com/browse/MIFOS-4112?page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#action_10119
 ]

jasmine sandhu logged work on MIFOS-4112:
-----------------------------------------

                Author: jasmine sandhu
            Created on: 14/Nov/10 10:38 PM
            Start Date: 14/Nov/10 10:34 PM
    Worklog Time Spent: 5 hours 
      Work Description: Not much progress on this other than ideas so work log 
just contains documentation for now:
typeMismatch errors are binding errors as opposed to validation errors. As an 
example, consider the following:

defineLoanProducts.ftl with associated controller 
DefineLoanProductsFormController.java

when the form is filled and the POST method is invoked, the processFormSubmit 
method is called. The BindingResult object is passed to this method, which will 
contain a binding error if there is a type mismatch between what the user input 
and what the form backed object expects. The spring DefaultMessageCodesResolver 
defines the possible error codes for binding errors 
(http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/validation/DefaultMessageCodesResolver.html).

The validation is checked by LoanProductFormBeanValidator, which appends an 
ObjectError object to the BindingResult object for each constraint that is 
violated. These are not binding errors, but rather constraint violations. And 
since we define ObjectError in the LoanProductFormBeanValidator class, we have 
more control over the validation error codes and their input arguments. 

Several things to try:
(1) rejectValue(): the springframework Errors interface has a rejectValue 
method that can be used to reject the given field. This basically appends this 
error to the BindingResult object. It does not however change the original 
binding error.

(2) use a custom editor to parse the form field and if the data type is 
anything other than a number then set the field to null and let the validation 
error trigger. Or perhaps a custom binding error can be triggered.

I believe you can also define custom constraints; however, this is a binding 
error not a validation error.

Issue Time Tracking
-------------------

    Time Spent: 1 week, 2 days, 5 hours  (was: 1 week, 2 days)

> Resolving MIFOS-3859 exposed a bug where typeMismatch.* error messages do not 
> display correctly
> -----------------------------------------------------------------------------------------------
>
>                 Key: MIFOS-4112
>                 URL: http://mifosforge.jira.com/browse/MIFOS-4112
>             Project: mifos
>          Issue Type: Bug
>          Components: Loan Account
>            Reporter: jasmine sandhu
>            Assignee: jasmine sandhu
>             Fix For: Elsie F
>
>         Attachments: typeMismatchError_after3859.png, 
> typeMismatchError_after3859.png, typeMismatchErrorOnCI_oldCode.png, 
> typeMismatchErrorOnCI_oldCode.png
>
>          Time Spent: 1 week, 2 days, 5 hours
>
> In fixing: http://mifosforge.jira.com/browse/MIFOS-3859
> the error messages displayed when the defineLoanProducts.flt form is 
> incorrectly filled are validated by LoanProductFormBeanValidator.java. This 
> class constructs the keys for the messages based on the constraint violation, 
> so if the field is null, it constructs a message as:
> NotNull.loanProduct.*
> This message is then read from messages.properties. The messages of the form: 
> typeMismatch.loanProduct.* are not being displayed correctly after this 
> parameterization. 
> As an example, if I enter a string for the first entry in the Last Loan 
> Amount table, it should trigger a typeMismatch error (see attached images).
> In the previous version, it appears the typeMismatch.* key was not being 
> read, but the error was nicer in that it displayed:
> Invalid data
> Now, with the update, the error reads the string from the key but does not 
> replace the parameter correctly. So it shows up as:
> Please Specify the valid Start Range Loan Amount for by last loan at row 
> loanAmountByLastLoanAmount[0].lower
> but it should show up as follows if the error occurred on row 1:
> Please Specify the valid Start Range Loan Amount for by last loan at row 1.
> The commit for Mifos-3859 is: 7d543c9621afadd7754e72b83401678b0bf410ca

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

        

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues

Reply via email to