Forums

Message validation

zeroblues 22 Feb, 2016
Hello,

I have a problem with the validation. When I leave the message container there is always a message like "you need numbers in this field" no matter if I set validation on alphanumeric or if I turn it off. Any idea?

Best Regards, Blues
GreyHead 22 Feb, 2016
Hi Blues,

No idea - please post a link to the form so I can take a quick look.

Bob
GreyHead 22 Feb, 2016
Hi Blues,

Yes, alphanum means a-z-A-Z0-9 only,

Bob
zeroblues 22 Feb, 2016
But if I turn it all off? It's still the same Problem. I send you the site via PM. Thank you!
GreyHead 23 Feb, 2016
Hi Blues,

You have alpha validation on all the inputs - that only allows a-zA-Z I suggest that you remove that too.

Bob
zeroblues 23 Feb, 2016


But it is switched off. That is my problem. Is there another way to deactivate ist?
GreyHead 23 Feb, 2016
Hi Blues,

Please check the Code tab in the Form Editor - if that has been set to Custom then changes in the Designer tab no longer have any effect.

Bob
zeroblues 23 Feb, 2016
Thank you! I think that is the solution.

<div class="gcore-input gcore-display-table" id="fin-textarea4"><textarea name="Message" id="textarea4" placeholder="" rows="3" cols="40" class="validate['required','alphanum'] form-control A" title="" style="" data-wysiwyg="0" data-load-state="" data-tooltip=""></textarea></div></div><div class="form-group gcore-form-row" id="form-row-captcha"><div class="gcore-subinput-container-wide" id="fitem"><label for="captcha1" class="control-label gcore-label-left">Captcha</label>

Whats is the code for no validation?
validate['required','alphanum']
GreyHead 23 Feb, 2016
Hi Blues,

Unless you particularly need the Custom setting* I'd switch back to Wizard, then the element settings will work OK. The class you need is probably class="validate['required']"

Bob

* Even then I'd recommend using Custom Code elements in the Design tab for those parts.
zeroblues 23 Feb, 2016
1 Likes
Thank you very much, now it works.

The guy who coded the template for me used the custom code section even for the address and Google map. I would have made it in a different way.
zeroblues 24 Feb, 2016
One more thing:
The validation of the e-mail address is not possible when there is a "ü","ö" or "ä" in the address. Is the only solution that I deactivate the validation for it?
GreyHead 24 Feb, 2016
Hi Blues,

You can either hack the regex code at line 10 of /libraries/cegcore/assets/gplugins/gvalidation/gvalidation.js Or, possibly better, use a Custom Validation function instead of the default one.

The problem that you have is that email addresses are very difficult to validate - and validation does not tell you that the address is real. See here for a neat essay on this - or this StackOverFlow page

You can get a PHP validator function from here or a useful JavaScript mail helper from here

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