Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] jqv:custom rule not found - phone

[SOLVED] jqv:custom rule not found - phone 07 Nov 2012 20:38 #5048

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
I have tried removing the rules from the fields.. saving, then readding PHONE NUMBER

I have removed the fields from the forms after this change and readded. This error keeps coming back on any data type I specify as PHONE NUMBER
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 20:50 #5049

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
I am guessing (still working in sandbox, so not tested) I can add a phone validator type by just adding

$baseRules["phone"] = array(
"#regex" => '^(\+[1-9][0-9]*(\([0-9]*\)|-[0-9]*-))?[0]?[1-9][0-9\- ]*$',
"alertText" => LI_PREFIX . addslashes(JText::_("MOLEFS_FORMVALIDATOR_THIS_IS_NOT_A_VALID_PHONE")),
);

in the validator file will do the trick?
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 20:57 #5050

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Have you actually specified a custom rule with a handler called phone?

If so, are you absolutely certain that your regex is a valid php/js regular expression - I mean, is it tested? To elaborate;
  1. I believe there is already a phone handler. Handlers must be unique and therefore, if you've specified a handler called phone, you should give it a unique name with no underscores, spaces or any chars other than alphanumeric.
  2. Also, the validator in the builder that gives a green tick for valid or red cross for invalid does not actually guarantee that the expression works, only that the pattern conforms to the construct of a valid regex.
Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:26 #5054

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
I have, and selected using the COOK dropdown choice of 'Phone Number'. I have looked in the validator code on the download, and there is nothing specified for PHONE or PHONE NUMBER.

I can work around it after I have downloaded the code, just wanted to raise the issue as a builder potential error as its seems to be with any project or table I create. I am using the J2.5 beta settings

In the builder, the regex tests fine (green tick) its only when I actually test it in sandbox it fails
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:31 #5057

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Sorry, just to be clear, you've selected 'custom' or phone number in the dropdown?

So, is the regex your own expression or a built in one?

Gez

PS as I said in previous, if it is a custom rule, you need to be sure that the handler name is unique...
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:42 #5059

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
I have tried Cooks drop down choice of Phone Number - Gives the error in sandbox

I have tried a CUSTOM validator using Cooks regex code that is generated by selecting Phone Number and selecting 'phone' as a handler (this appears by DEFAULT) - Gives the error in sandbox

I have tried using the regex code for phone number that the builder generates with a validator as numeric (to try to get around it) - Gives the error in sandbox

In other words I have tried ALL the default builder choices for validating as a phone number and a few custom ones as well

I then download the component, and looked at the validator.php in the helpers folder and saw that there WAS no validator programmed for 'phone' or 'phone number' as a handler, which is why I asked if the specified sample would work.. which I will find out later.

So all this wall of text aside, the reason for this ticket.. when using the beta builder for J2.5, if I just use the default build choices for validating a data type as a 'Phone Number' it errors in sandbox with Re: jqv:custom rule not found - phone
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:49 #5062

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Looks like a lot of the default rules aint working

jqv:custom rule not found - decimal_10_2

Again, from the basic drop down list in the builder
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
Last Edit: 07 Nov 2012 21:49 by MorganL.
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:51 #5063

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Gimme a minute... need to get a drink and a bit of fresh air... I'll log in to a test component and give em a whirl now. Could you post your entire config page please?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 21:54 #5064

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
2.0 Beta

Jquery
Condesned
Maxium
No

Model
Maximum

if there is some instruction I missed for using Beta2.0, I will slap myself round the head
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
Last Edit: 07 Nov 2012 21:55 by MorganL.
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 22:08 #5065

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
OK,

Just checked a project that I have a custom telephone regex in and all is working fine. For note, I have an identical config to your too... Here's how:

In your string field
  1. Select custom as you have done.
  2. In the handler, type an alphanumeric string to represent the regex - mine is teluk although for others, I sometimes use handlers such as alphannumcode2to10 to represent the shortest/longest length values.
  3. Add your custom regex in the regex field - mine is
    ^[0-9]{0,5}[ ]{0,1}[0-9]{0,6}$
I think that the problem is that you've been leaving the handler name as the standard phone handler which has caused a collision between which rule to use.

I hope this helps! Let me know how it goes?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL

Re: jqv:custom rule not found - phone 07 Nov 2012 22:22 #5068

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Definitivly, you cannot use the '_' in the regex handler with V2.0. (decimal_2_10 is wrong) For the moment, it is not managed.
Ticket stays open at least for that.

But for the phone regex in question, did you tried it before in both PHP and JS ?
(JS for example is not accepting '\d')

Your validator class is handling the regex validation on the fly. So you must check the source afterwards, not in the validator class. (I think it handle only 4 default handlers)
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL

Re: jqv:custom rule not found - phone 07 Nov 2012 22:28 #5070

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
I'm not absolutely certain but I think that at the moment, some of the built in rules use underscores in handlers - for instance, I think that the decimal one mentioned by @morganleecy... I know that they definitely don't work in custom rules as I've experienced many issues due to this alone.

I just double checked the custom phone that I've used previously and it works fine - no errors at all!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL

Re: jqv:custom rule not found - phone 07 Nov 2012 22:44 #5074

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
appreciate the responses at this late hour. I will define my own as explained above with the teluk example, and thanks

and yeah, underscore is specified with the drop downs in the builder.. decimal_10_2 one example, and there are indeed only 4 handlers defined at present
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
Last Edit: 07 Nov 2012 22:45 by MorganL.
The administrator has disabled public write access.

Re: jqv:custom rule not found - phone 07 Nov 2012 22:55 #5076

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
The predefined RegEx of cook are not garanteed.

RegEx is an Art, Really !!!
Some RegEx are soooo beautiful. Those proposed by cook are really not advanced. I would like to implement a good sharable RegEx lib in the community environment, but not as priority.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL, JoomGuy
Time to create page: 0.090 seconds

Get Started