Closed (fixed)
Project:
Webform
Version:
5.x-2.0
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Jun 2008 at 10:14 UTC
Updated:
21 Sep 2008 at 04:35 UTC
Hello,
Webforms allow to implement a lot of fields such as email, textfield... but I haven't seen any to implement an URL. Is this possible? how?
Thanks
Comments
Comment #1
quicksketchIs there anything special about a URL field other than a little validation? I'd probably suggest using textfield, then use the Additional Validation field to validate that field as a URL. There are a couple examples of how to do custom validation on the Webform project handbook: http://drupal.org/handbook/modules/webform
Comment #2
c-c-m commentedHello,
Thanks for replying.
I have completely rebuilt my site (I have migrated it from phpnuke) and many links will break. I want to make a form so my users can refer to any page whith a broken link so I can repair it. I would like to validate that the provided URL belongs to my domain, that's why I asked.
Comment #3
quicksketchYep, that's a perfect use-case for additional validation then, especially since you need to not only validate the URL, but make sure it comes from a particular domain. If you give your new URL field a form key, of "url", you could use the following code:
Open up the "Webform advanced options" and use the code in the "Additional validation" field.
Comment #4
c-c-m commentedThank you very much!
Comment #5
quicksketchOops, I have an equality operator backwards in there. I haven't tested any of this code, but it's along the right idea for sure.
Comment #6
c-c-m commentedHello,
I may be doing something wrong, I copied-pasted your code into "Webform advanced options" in the "Additional validation" field and replaced "http://mysite.com" with my real domain and it never works. I also deleted
['submitted_tree']and replaced['url']by['url_del_error'], which is the field's name. It doesn't work neither.In addition, when editing the Additional validation parameters they are empty, no matter what I wrote. (I am using TinyMCE, but have turned it off when editing this form)
Any help?
Thanks
Comment #7
quicksketchPruning the issue queue. Sorry I'm not able to provide further help on this issue.