Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [SOLVED] qv:custom rule not found - decimal_comma

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:28 #5456

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
OK, so what is the highest and lowest acceptable number?

0,0 is the lowest right?

Would a number such as 100000000000000000000,9 be OK?
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:29 #5457

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
And would 0,0000000000000000009 be OK?
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:29 #5458

  • goslingcools
  • goslingcools's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 7
  • Karma: 1
Sorry,

But the price range will probably be from 0 to 999,99

Both fields should only use 2 digits after the COMMA, so NO 0,000000007

So infact It can be any number between 0 and 1000. With 2 digits after the Comma.
Last Edit: 18 Nov 2012 12:33 by goslingcools.
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:32 #5459

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
OK so anything between 0,00 and 999,99 is acceptable...
1000,01 is not?

But, you do only want 2 digits past the comma right?

Gez
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:34 #5460

  • goslingcools
  • goslingcools's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 7
  • Karma: 1
The max does not matter, I don't want to limit it (only for what is necessary according to the db format)
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 12:36 #5461

  • goslingcools
  • goslingcools's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 7
  • Karma: 1
Should I use a text field instead of a decimal field and use a custom validation on it?

Hmm... this won't work because the comma validation rule is missing...
Last Edit: 18 Nov 2012 13:09 by goslingcools.
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 13:22 #5462

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
Yes,
  1. use a string field and select custom from the validator.
  2. type in your max length that includes the comma as a character - so 9 following this example - into the length property of the field
  3. add a unique and descriptive handler like decimal6comma2 where 6 is the max digits before the comma and 2 is the max digits past the comma.
  4. Paste this regex in
    ^(0|[1-9]\d{0,5})?(,\d{1,2})?$
  5. test it in the Preview and Test field
Currently this will allow:
0,0
0
0,00
0,09
0,99
123456
123456,1
123456,10
123456,99
999999,99

Hope it helps!

Gez
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.
The following user(s) said Thank You: goslingcools

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 13:33 #5463

  • goslingcools
  • goslingcools's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 7
  • Karma: 1
Thanks,

This looks perfect! I'll have a try with it asap.
Let you know how it works out.

Thanks again!

btw. just got a book about reg ex, still need to study it :-)
Last Edit: 18 Nov 2012 13:34 by goslingcools.
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 15:05 #5465

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
Hi GC ( @goslingcools )
Have you got it working OK?
btw. just got a book about reg ex, still need to study it
No book for me but, yes, me too!!! :sick: It can pretty involved!

We have an awesome regex'er (@g1smd) who's posts have helped me a lot! Checkout the RegEx section in the forum and post any of your work or queries there. Hopefully, over time we can build a robust base of common (and exceptional) expressions where we can all learn from one another!

Anyway, hope it is working fine however, I'm sure with the help of the posts in regex section and your book you'll be able to adapt it to your needs!

Gez
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 16:59 #5468

  • g1smd
  • g1smd's Avatar
  • Offline
  • Junior Member
  • RegEx fiend!
  • Posts: 31
  • Thank you received: 26
  • Karma: 6
^(0|[1-9]\d{0,5})?(,\d{1,2})?$
also allows

,5
,99
blank

Remove the first comma to insist on something before the comma. :cheer:
Online since 1996.
Last Edit: 18 Nov 2012 17:03 by g1smd.
The administrator has disabled public write access.

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 17:12 #5469

  • audibleid
  • audibleid's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 68
g1smd wrote:
^(0|[1-9]\d{0,5})?(,\d{1,2})?$
also allows

,5
,99
blank

Remove the first comma to insist on something before the comma. :cheer:
Hi @g1smd

I believe GC wanted to allow ,0 AND ,01 inputed vals (although, I clearly left them out of the valid list).

blank will be caught by the required attribute being set on the field.

Thanks again for your regex-ninja input!!!

Gez
Need assistance in the forums? Please start here before posting. **If someone goes to the trouble of providing you with a solution to a problem, please at least have the decency to reply and say thank you!

Need help with your Cook/Joomla Project??? Feel free to ask for my assistance on my Facebook...
The administrator has disabled public write access.
The following user(s) said Thank You: g1smd

Re: qv:custom rule not found - decimal_comma 18 Nov 2012 17:19 #5470

  • g1smd
  • g1smd's Avatar
  • Offline
  • Junior Member
  • RegEx fiend!
  • Posts: 31
  • Thank you received: 26
  • Karma: 6
Cool!

Just pointing out a minor change that other people might want to make.

(\,{1,2})? allows for one or two digits if there is a comma, or nothing at all.

(\,{2})? insists on exactly two digits if there is a comma, or nothing at all.

The first part of RegEX writing is defining exactly what you want it to do. That should take longer than writing the actual pattern.
Online since 1996.
The administrator has disabled public write access.
The following user(s) said Thank You: audibleid
  • Page:
  • 1
  • 2
Time to create page: 0.105 seconds

Get Started