[Xsltforms-support] Entering negative number with incremental="true"
Brought to you by:
alain-couthures
From: David C. <ot...@cr...> - 2010-04-02 20:54:45
|
Given a form that specifies an input type of integer, or any variant thereof, that also specifies incremental="true" doesn't work very well. When the initial negative sign is entered, it is replaced with the value "NaN" as can be seen in the sample form below. The problem appears to be a result a conditional expression change in XFInput.setValue() made in rev 342. What was the reasoning for the change and what side effects would be expected if it's reverted? If the change shouldn't be reverted, is there any other way to avoid the NaN replacement when users (typically) enter a negative number starting with the negative sign? I reverted the change locally and haven't seen any problems with the forms I'm working with, but it's possible those forms are not using any techniques that trigger the problem that resulted in the change in rev 342. - David <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Integer Validations</title> <xf:model> <xf:instance> <data xmlns=""> <I1/> <I2/> </data> </xf:instance> <xf:bind nodeset="/data/I1" id="i1" type="xf:negativeInteger" /> <xf:bind nodeset="/data/I2" id="i2" type="xf:negativeInteger" /> <xf:action ev:event="xforms-ready"> <xf:setfocus control="input-1" /> </xf:action> </xf:model> </head> <body> <p> This field does not use incremental validation.<br /> <xf:input id="input-1" bind="i1"> <xf:label>Enter a negative integer: </xf:label> </xf:input> </p> <p> This field uses incremental validation.<br /> <xf:input id="input-2" bind="i2" incremental="true"> <xf:label>Enter a negative integer: </xf:label> </xf:input> </p> </body> </html> |