1

In the node creation form, when a user unchecks the "Automatic alias" checkbox, the user can put apostrophe and other punctuation marks, which is not good in a URL.

How can I prevent this from happening?

  • 2
    You could always deny them the ability to edit that in the first place via permissions. – BenjaminRH Jan 19 '12 at 18:28
1

Use hook_form_FORM_ID_alter() to add your own validation function to node edit forms. In this validation function you'd check for characters that you want to allow/deny, and throw a form_set_error() on that field if there's a problem.

1

As mention you can set them as unavailable characters for the URL. I always install the transliteration module as well. It will help keep your URLs in check

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.