Forums

URL Validation and Submission

Becca800 22 Feb, 2009
Hi there. Currently, on my form, I have a url form field which is optional. I have the validation on which checks for correct url structure. The form will still submit even if the structure is incorrect. The script appears saying that a correct url needs to be entered, but it still submits. How do I change that so that it will not submit until fixed?
GreyHead 22 Feb, 2009
Hi Becca800,

The url validation is a pretty standard regexp check so I don't see any reason why it doesn't work. Most often this seems to be because of some JavaScript error on the page. If your form on-line so we can take a look?

Bob
Becca800 25 Feb, 2009
Hi Greyhead. Since you brought it up, it probably is a js issue, I have a ton if it. The forms I have created are very dynamic and do a lot. I am still working on perfecting it. Please see: http://www.mytownrealestateagent.com/sign-up
And thanks in advance.
GreyHead 25 Feb, 2009
Hi becca800,

The validation regexp matches a url of the forms http://www.example.com/ (or https:// or ftp://) with different numbers of subdomains and with or without the trailing slash.

It won't recognise a typical SEF URL like http://chronoengine.com/forums/posting.php?mode=reply&f=2&t=12696

If you need that then you can try a custom validation using this Regexp (from Regex Buddy)
^\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]
(or hack the MooValidation file if you prefer).

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