From: webERP D. <web...@li...> - 2013-07-17 10:26:35
|
Well the pattern we use will have to be different depending on: a) the user's locale b) the number of decimal places that are allowed so pattern="(?:^\d{1,3}(?:\.?\d{3})*(?:,\d{1,})?$)|(?:^\d{1,3}(?:,?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:\.\d{, })?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:,\d{1,})?$)|(?:^(\d{1,2},)?(\d{2},)*(\d{3})(\.\d+)?|(\d{1,3})(\.\d+)?$)" is a bit of a kludge and a very long one that really doesn't check accurately the number format in any event as it doesn't take into account the actual number format particular to the locale nor the number of decimal places allowed. In any event we don't need to trap the numbeir format that closely either as it doesn't matter if the user enters with or without decimal separators. This looks like regular expressions gone MAD to me and given that it really isn't that good I don't think it is worth it IMHO. Better off just sticking with Tim's class="number" format.... he has also developed a class="integer" which doesn't allow the hyphen to get negatives nor any decimal separators so quite a good additional check... should try to bring that in I think. Tim has also made some improvements to the confirm boxes but probably unnecessary really, especially since it adds significantly to the size of the file. I do like the improvement he has made to allow sorting tables so that needs to be brought in too - actually not much code required for this as it turns out. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz skype:daintree On 17/07/13 18:52, webERP Developers wrote: > *Hi, Phil:* > > I've checked the html5 transaction page. And it seems that the > current gating issue is the number validation. > > I've studied Tim's js function. The function only validate users' > input by single character. A pattern is a must to ensure the correct input. > I've made one as following: > > > pattern="(?:^\d{1,3}(?:\.?\d{3})*(?:,\d{1,})?$)|(?:^\d{1,3}(?:,?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:,\d{1,})?$)|(?:^(\d{1,2},)?(\d{2},)*(\d{3})(\.\d+)?|(\d{1,3})(\.\d+)?$)" > > It used to validate number format pattern as described in > webERP's languageArray.inc. > > It is tested OK in firefox and js regex on line. But it seems that > it does not work in Chrome. > > Any comments are welcome! > > Thanks and best regards! > > Exson > > > > > > -- > View this message in context: http://weberp-accounting.1478800.n4.nabble.com/Intention-to-roll-up-new-version-and-future-plans-tp4656547p4656589.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |