Submitted by Art Williams on Tue, 06/07/2011 - 10:08am

Dan,

Nice Catch. The validation code in the comment.module cannot handle homepage as NULL or unset. I just tried both. This is a unique situation because of the validation code in the module.

But, I don't really like using #type = 'hidden' because a savy user could still insert a value in that field if they wanted. And you can run into problems if the field is both 'hidden' and 'required'. That isn't the case here, but it would be a good practice to set #required = FALSE whenever you set type to hidden.

My preferred solution:

$form['author']['homepage']['#access'] = FALSE;

This both hides the field and prevents any user input.

I will update the post to reflect this change. Thanks again for catching this issue.

The content of this field is kept private and will not be shown publicly.

Plain text

  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.