Hi,
It seems that the validation option validate-alphanum does not work, as anything can still be input, not just letters and numbers.
Any fix appreciated.
- Vince
Hi Vince,
I think it's using an odd RegExp !/\W/ - that appears to be checking that the entry is not not a word character. (Double negative intended.) I think that has to be an error . . ., I'm not even sure that the ! works in a RegExp.
Bob
Hi Bob,
So how do we fix it, or need to wait for Max?
Thanks,
Hi Vince,
please get RC5.1 and try this, if it didn't work again then we now have an alternative route to add our custom validation which should work fine!
Regards
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max,
Installed RC5.1 but still no different for alpha-num validation.
The JSvalidation2.php file no longer seems to have the pattern !/\W/
What is the alternative route to add our custom validation you mentioned to get this sorted?
We do need this to work because many company names have a combination of letters and numbers somestimes.
Many thanks,
- Vince
Hi Vince,
in RC5.1, add this code in the JS box:
window.addEvent('domready', function() {
var field_name = new LiveValidation('field_id');
field_name.add( Validate.Format, { pattern: /[A-Za-z ]/i } );
});
let me know!
Cheers
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi,
May be worthwhile making sure I'm adding this code in the right place:
Form code -->> Form Javascript
Added your suggestion, but still allowing special characters: * & % / etc
Thanks,
- Vince
Hi Vince,
I checked your form, is this for the School field ?
if so then you need to replace field_name by "school" and need to add an id to your field, say "school" too and replace field_id by that "school"
so the final code should be:
window.addEvent('domready', function() {
var school = new LiveValidation('school');
school.add( Validate.Format, { pattern: /[A-Za-z ]/i } );
});
preferably, don't select this field as validated for alphanum in the validation tab, we add the validation manually here!
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Vince,
you didn't add the id for the school field (id="school")
you will need to add 0-9 if you need the field to accept numbers!
your form link is no longer working and so I cant check it anymore!
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max,
The form link had to change as per your instructions, so same link as before but remove the two '-'
Not sure what you mean by id for school field.
I have <input name="school"
Hi Bob,
Thanks for your help and please excuse my ignorance.
Would we need to add an id to all form fields?
- Vince
Hi Jvince,
id's aren't required but they are highly desirable and my recommendation would be that you add them as a matter of course.
Usually the id can be the same as the name - but the id has to be unique so ths won't work for multiple submit buttons, radio button or checkbox groups. Here I add a numeric suffix radio0_1, radio0_2, . . .
The id is most often used by JavaScript - and if you aren't using any Javascript you can probably safely ignore them. The Mootools library has a short-cut to address a field which is $('field_id') and once you have that you can read or change pretty much any field attribute. (You can do the same with the name but it's nto so strightforward - and, if the name isn't unique, can cause problems.)
Note that you cna also use JavaScript plus ids on for example <div>s or <span>s to change their visibility or formatting, it's not just limited to form inputs.
Bob
Hi Vince,
Ok, please resend me the form link and i will check it and try to find whats wrong!
Cheers
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max,
I PM'ed you the link, have you had a chance to have a look?
many thanks,
- Vince
Hi Vince,
sorry but I was off for few days, just tested it and it works flawlessly!
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max,
You tested the 'School' field?
It should only allow alpha-numeric, but instead allows special characters, ie. * & / %
Thanks
Hi Vince,
just tested again with FF 3 and IE7 and it will not allow @ or # or $ !!
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
I don't understand why it's different for you and me.
I have tested in both browsers on 2 different PC's on different phisical locations and networks.
Maybe you are testing onsubmit and I am testing before submit?
Here is a screenshot before submition.
[attachment=0]validationr.jpg[/attachment]
note the only error message missing is on Schools field. :-(
Thanks
Hi Vince,
what do you mean by "onsubmit" and before submit here ?
please try to test with @ or # ?
when you hit submit with % in the field, does it let you submit ?
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
I just meant before or after pressing the submit button.
I expected the validation on the schools field to work same way as the others - but it doesn't
The invalid error messages disappear once you move to another field, but this doesn't happen on the other fields so was confusing to me - and maybe other users?
If you do press the sub,it button with invalid entry within the schools field, the form does actually work as expected, in that the error message apears and the form does not get submitted.
Sorry for any confusion on this.
The other issue is I don't know how to change the code to make this field as originally intended: allow alpha-numeric.
Currently, no numbers are allowed.
Many thanks,
Hi Vince,
Just tested this and it works very fine here:
window.addEvent('domready', function() {
var school = new LiveValidation('school');
school.add( Validate.Format, { pattern: /^[0-9a-zA-Z ]+$/i } );
});
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Perfect Max.
Thank you very much
- Vince