Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Pasting "(" in WebCurrencyEdit or WebCurrencyEditor does not always give negative number
posted

Hi.  We recently upgraded our website from using Infragistics controls Version=9.1.20091.1015 to Version=11.1.20111.2064.  On a given page we use the WebCurrencyEdit (several times), with the culture set so that negative numbers are shown as "-$n" instead of "($n)".  Before the upgrade, users could paste negative values of either format and in both cases the value would properly be converted to a negative number in the "-$n" format.  Since upgrading, a negative number pasted in the "($n)" format is converted to a positive number instead of a negative number in the other format (unless the culture is set to always display negative numbers in that format).

I tried the newer WebCurrencyEditor control and got the same behavior.

Unfortunately, our clients are adamant that the controls work the way they did previously.

Firstly, is there a reason this was changed so that pasting a negative number in either format wouldn't automatically translate to a negative number in the specified display format?  Would you be willing to restore this behavior in future releases?

In the mean time, how would I change this myself?  Unless I am mistaken, I think the two possible approaches would be to intercept the keystrokes in clientside scripts (looking for a "(" and replacing it with a "-"), or changing ig_edit.js for the control itself.

The latter seems cleanest... I think I see the the issue in the line:

me.isMinus=function(k){return k==this.minus.charCodeAt(0)||k == 45||(k==40&&this.negativePattern.indexOf('(')>=0)||k==12540||k==65293||k==65288;}

which maybe should be changed to:

me.isMinus=function(k){return k==this.minus.charCodeAt(0)||k == 45||k==40||k==12540||k==65293||k==65288;}

But if so, I am having trouble getting the site to see the modified version of the file.  I presume it is using the now embedded version of the script.  I have tried changing the web.config to use

<infragistics.web styleSetName="IFBlue" styleSetPath="~/ig_res" enableAppStyling="false" javaScriptDirectory="~/ig_common/20111CLR40/Scripts" />

When that didn't seem to have any effect, I tried changing the JavaScriptFileName property of the control directly:

<igtxt:webcurrencyedit id="Webcurrencyedit1" width="140" runat="server" HorizontalAlign="Right" JavaScriptFileName="~/ig_common/20111CLR40/Scripts/ig_edit.js">
</igtxt:webcurrencyedit>

Still doesn't seem to be using the right version of the javascript.

Any ideas?  Any help would be much appreciated!