diff --git a/drupal/sites/default/boinc/modules/boincuser/boincuser.js b/drupal/sites/default/boinc/modules/boincuser/boincuser.js
new file mode 100644
index 0000000000..cf6dbe73fc
--- /dev/null
+++ b/drupal/sites/default/boinc/modules/boincuser/boincuser.js
@@ -0,0 +1,17 @@
+// Javascript for disabling the submit button, enables it when
+// terms-of-use checkbox is checked.
+
+$(document).ready(function() {
+ // Disable submit on initial page load
+ $("#edit-submit").attr("disabled", "disabled");
+ // On checkbox change, enable submit button
+ $("#edit-termsofuse-agreeTOU").change(function () {
+ if ($("#edit-termsofuse-agreeTOU").is(":checked")) {
+ // enable submit
+ $("#edit-submit").removeAttr("disabled");
+ } else {
+ // disable submit
+ $("#edit-submit").attr("disabled", "disabled");
+ }
+ })
+});
diff --git a/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc b/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc
index c614a5c116..227f315d59 100644
--- a/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc
+++ b/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc
@@ -697,40 +697,49 @@ function boincuser_termsofuse_form() {
drupal_set_message( bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning' );
$form = array();
-
- // Terms of use section
+ drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js');
$termsofuse = variable_get('boinc_weboptions_termsofuse', '');
- $form['title1'] = array(
+
+ // Fieldset to hold all of the form as a container
+ $form['termsofuse'] = array(
+ '#type' => 'fieldset',
+ '#prefix' => '
', // This is our wrapper div.
+ '#suffix' => '
',
+ '#tree' => TRUE,
+ );
+
+ $form['termsofuse']['title1'] = array(
'#weight' => -12,
'#value' => '' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '
',
'#prefix' => '',
'#suffix' => '
',
);
- $form['termsofuse'] = array(
+ // Terms of use section
+ $form['termsofuse']['body'] = array(
'#weight' => -10,
'#value' => bts($termsofuse, array(), NULL, 'project:termsofuse-form'),
'#prefix' => '',
'#suffix' => '
',
);
- $form['agreeTOU'] = array(
- '#type' => 'checkbox',
- '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:termsofuse-form'),
+ $form['termsofuse']['agreeTOU'] = array(
+ '#type' => 'checkbox',
+ '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:termsofuse-form'),
'#weight' => -8,
'#prefix' => '',
'#suffix' => '
',
);
- $form['spacer'] = array(
- '#prefix' => '',
+ $form['termsofuse']['spacer'] = array(
+ '#prefix' => '
',
'#value' => ' ',
'#suffix' => '
',
);
// Form Control
$form['submit'] = array(
- '#prefix' => '
',
+ '#prefix' => '',
'#type' => 'submit',
'#value' => bts('Yes', array(), NULL, 'boinc:form-submit'),
'#suffix' => '',
@@ -756,7 +765,7 @@ function boincuser_termsofuse_form() {
function boincuser_termsofuse_form_validate($form, &$form_state) {
// Check TOU agreement
- if (!$form_state['values']['agreeTOU']) {
+ if (!$form_state['values']['termsofuse']['agreeTOU']) {
form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', array(), NULL, 'boinc:termsofuse-form'));
}
}