0

Like the title says really, I'm trying to add a script to my register page, I'm using Zen as my theme, and I've added a script into the .info file, and to just test that it works I have added an alert() function, and it runs on just about every page except the default register page, and I don't know why, it just doesn't call the script at all.

The longer version is that I have a bespoke Drupal site, not intended for public use, just for specific medical personnel to use for an event we have coming up. What the client has requested is that the user must tick a box declaring they are a healthcare professional before they can register. I have added a boolean checkbox to my register form, and set it to mandatory, but obviously Drupal will accept either checked or unchecked, I want to make it so that they have to check the box before they can register (it's just a legal compliance thing)

I wanted to try to do it via Drupals methods only, but my backup was creating a js solution which would set the register button to disabled until the box was checked, except it doesnt seem to work on the register page.

Can this be done?

| improve this question | | | | |
2

If you make a checkbox required it should force the user to check it (if you have an up to date version of drupal core). See the issue here where that was fixed.

For older versions of drupal there was the checkbox validate module.

As for adding javascript in your info file. That will add it to every page. So either the page it doesn't work on is using a different theme (and therefore a different info file), or there is a javascript error on the page that is preventing your code from running.

Check your page for javascript errors.

There is also the legal module, which allows you to set terms and conditions that the user has to agree to when signing up. The module handles the checkboxes. It might not be right for you but it is another option.

| improve this answer | | | | |
  • I think I was possibly being a little hasty in writing off the Drupal default. I've sort of inherited a previous code build and I think the previous developer had written some custom code which ended up affecting the perceived register page. However, I think that legal module is absolutely ideal for what I want to do, thanks :) – Andrew Morris Aug 15 '13 at 11:26

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.