Validation makes field mandatory

btushar 20 Aug, 2007
Hi,

If I set the validation rule for any field, the 'required' rule is applied automatically (even if not desired)
eg. I have a telephone number field, and want it to be an optional field, but when the user enters some value, it should only be a valid number. So I set the field to be a 'valid-number'. But currently, that field also becomes mandatory.

I am attaching a fix to the above mentioned problem (have modified the showform() function in the file chronocontact.php - rename the attachment to .php)

Anyways, I do not much like the concept of using the much used class attribute for setting validation rules. But that is the implementation decision of the validation functionality developer and as long as it works for the users and they are aware of it, then its fine by me.

Regards,
Tushar [file name=chronocontact.txt size=16544]http://www.chronoengine.com/components/com_fireboard/uploaded/files/chronocontact.txt[/file]<br><br>Post edited by: btushar, at: 2007/08/20 07:59
GreyHead 20 Aug, 2007
Hi btushar,

I agree that this is a flaw in the validation rules (any validation makes the field required) and I expect that Max will fix it in the next release.

I'm sure that there are better ways of implementing validation than using classes but the Really Simple Field Validation methodology is pretty straightforward and easy for beginners to use. Users are still free to turn it off here and use their own validation.

Thanks for the fix.

Bob
This topic is locked and no more replies can be posted.