I try to theme the output of my field called website using the hook_form_alter function

I try to add a javascript function to validate inline

		$form['field_website'][und][0]['url']['#attributes']['onblur'] = 'validateWebsite(value)';
		$form['field_website'][und][0]['url']['#field_prefix'] =  '<span id="websiteError" class="formerror" style="display: none;">You must enter a valid website address</span>'; 

It works for email field but not for link field. Do you know why ?

Comments

jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

I couldn't say, no. I don't know anything about this validateWebsite that you're using, or your site. Does the 'onblur' attribute appear for the url field? Are you sure your form_alter is being called? (I often find that it doesn't until I clear cache.) Do you have a javascript error on the page that's preventing the code from firing?

JKingsnorth’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further information supplied for a long while, and debugging suggestions have been provided, closing the issue. Please reopen if you still require support.