Loading...
 
Skip to main content

jquery validation regexp in numeric tracker field fails after upgrade from 12.x to 14.x

Status
Closed
Subject
jquery validation regexp in numeric tracker field fails after upgrade from 12.x to 14.x
Version
14.x Regression
Category
  • Regression
Feature
Edit interface (UI)
Resolution status
Fixed or Solved
Submitted by
Xavier de Pedro
Lastmod by
Xavier de Pedro
Rating
(1)
Related-to
Description

jquery validation regexp in numeric tracker field fails after upgrade from 12.x to 14.x

Reproduced here in a 14.x site:
http://xavi-9794-5706.show.tikiwiki.org/tiki-index.php?page=HomePage
u: admin
p: 12345

Attempt to insert an item, selecting some positive number (e.g. "10") at "My positive number": you get the error message shown "Number must be positive"

That regexp expression works as expected in Tiki 12.x:

Copy to clipboard
^[0]{1}$|^(?!0*[.,]0*$|[.,]0*$|0*$)\\d+[,.]?\\d{0,2}$


See it working in this equivalent 12.x instance:
http://xavi-9794-5707.show.tikiwiki.org/tiki-index.php?page=HomePage
u: admin
p: 12345

Workaround

I'm afraid the escaping of the regexp patterns changed at some point between 12.0 and 14.x (i thought in 12.3 or 12.4).
Now you must not double up the backslashes as you have in your pattern, so this one works ok in 14.x like this:

Copy to clipboard
^[0]{1}$|^(?!0*[.,]0*$|[.,]0*$|0*$)\d+[,.]?\d{0,2}$

I don't think it would be safe to try and do this with an upgrade script.


Thanks for fixing Jonny. And I agree this is not save to be in an upgrade script. However, this should be stated, though, in the upgrade instructions at doc.t.o at least, and at doc.t.o/Tiki14 page. I will drop some note there about it, and update the doc pafge about regexps also (doc.t.o/regexps)

Importance
5
Easy to solve?
2
Priority
10
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5707
Created
Monday 14 September, 2015 13:16:35 UTC
by Xavier de Pedro
LastModif
Tuesday 15 September, 2015 13:04:14 UTC


Show PHP error messages