Valid keystrokes swallowed entry Amounts on Payment, Charges.

Description

The Payment and Charges pages for Loans, Savings, Group charges, and Client
charges all eat keystrokes when the use rapidly enters a numeric amount in the
Amount field.

For example, if I rapidly type "1234" in the Apply Payment page's Amount field,
the value "14" shows up on the page.

Repro steps:
1. log in to test server
2. search for loan account 000100000000466 .
3. select apply payment.
4. enter "1234" rapidly for payment amount.

expected result:
"1234" shows up

actual result:
"14" shows up

Other pages noticed:
loan - apply payment
loan - apply charge
savings - deposit
client - apply charge
group - apply charge

Environment

Platform: All, OS: All

Activity

Show:
Jeff Brewster
November 6, 2009, 4:54 PM

fix typo

Jeff Brewster
November 10, 2009, 1:07 AM

Some investigation info from Sam:

I also found it on the "amount" and "interest rate" fields of the loan creation
page. I tracked it down to MifosDecimalInput.java, a custom jsp tag used for
decimal text inputs. This file includes conversion.js and injects the jsp with
this:

<input type="text" name="chargeAmount" value="" onkeydown="saveText
(this);this.focus();" onkeyup="return chekDecimal(7.2,this, event); "
onkeypress="return keyPress(7.2,this,event);" onblur="if( false ==
doValidation(this,null,null,7.2)) this.focus();"
id="applyCharges.input.amount">

I looked at conversion.js but couldn't make much sense of it. I noticed that by
pasting in an invalid number, like the string "hello", I can get around this
validation because it relies on keys being pressed. (That also explains why
normal selenium scripts do not encounter this, because when it uses the type
command it does not generate keystroke events.) When I put "hello" into the
numeric field I got a stacktrace NumberFormatException on the result page.

Kay Chau
November 11, 2009, 6:04 PM

leave in Backlog, not a showstopper, add Volunteer keyword

UdaiU
December 1, 2009, 2:14 PM

Fixed in trunk at r16321, Removed use of slow javascript for input validation.
Fixed NumberFormatException at invalid input "hello". The page will not show stack
trace, it will show the appropriate error.

Assignee

mifosdeveloperqueue

Reporter

Jeff Brewster

Labels

URL

None

Story Points

None

Team

None

Scheduled For

None

Epic

None

Notify

None

productboard URL

None

Man Day Estimate

None

Components

Fix versions

Affects versions

Priority

Major
Configure