One of my Drupal pet peeves is handling of the 'homepage' field on comment form.
First off, it requires user to enter 'http://', but provides no indication that it's required. Then it prints the absurd message that says "The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form http://example.com/directory." It's the 'remember' part that bugs me - how can anyone possibly remember something they've never been told.
Well, I fixed the stupid error message by creating a customer error message in stringoverrides module. But that doesn't really solve the problem fully because ~100% of people entering URLs will still get an error. A nicer error, for sure, but still a completely unnecessary error which adds an extra step to every comment submit.
So question is, can someone help me fix this? Three options as I see it - none of which I know how to do.
1. Add 'description' field beneath field that says "add http://" or whatever.
2. Pre-populate the field with "http://"
3. Fix back end handling to obviate need -- with case handling in event it is or is not entered voluntarily by user.
Can anyone point me in right direction for one of these solutions?
Thx!
Comments
Slight improvement
Hi, this article shows how to customise the comment submission form and add in a description field for the Homepage field at least.
http://www.kirkdesigns.co.uk/how-customise-comment-form-drupal-6
Sorry I can't offer more help, this feels like an 'error' to me too! This seems to have been knocking around as a pain in the neck for a few years now, I'd love to hear a solution or some pointers from more experienced Drupal developers?
Thanks!
...
thanks for the tip! it's a nice website and seems very thorough.
bit over my head, but maybe if i study it for a while.
=-=
while that will customize a form. It's a themeing function. I'd think you want to use hook_form_alter in a custom.module to alter the fields themselves by adding or unsetting them.
hook_form_alter is documented over on api.drupal.org
...
thanks, yes, that is probably right, but that's definitely over my head.
i had a fellow code it for me trying to implement #2 above. worked - in the sense that it pre-populated field with http://, but then that caused an unexpected problem. it generated an error in case where user didn't actually complete field with an actual website. so drupal interpreted the 'http://' as an incorrectly specified URL and dinged it making problem worse than it was to begin with.
not sure what we'll do with that. imagine that is a good bit of work to fix, so we'll probably just devolve to #1.