Required checkbox should have drupal's form required themed asterisk. Sorry, I could not figure out how to make this work in this module.

Comments

pcambra’s picture

Status: Active » Postponed (maintainer needs more info)

Hi

What's the issue here? When the tos are required, there is no * in the checkbox? Please confirm

echoz’s picture

Correct, I have the tos required in a checkout pane. Validation works by giving the error msg if you try to submit with the checkbox unchecked, but the checkbox does not have a red asterisk next to it.

My other required fields do have a red asterisk.

pcambra’s picture

Status: Postponed (maintainer needs more info) » Active

I think that this is intented for doing a custom validation message, I'll take a look to the code and I'll answer you more properly

3dloco’s picture

pcambra’s picture

Status: Active » Closed (works as designed)

This is intended, the "i agree with the terms of service" checkbox is not required anymore, it does a custom validation function in order to show an informative message instead of "field is required", please see http://drupal.org/node/790584

You can always use a theme form function for getting the asterisk, or a form alter to made it required.

I'm closing this by design, please feel free to reopen it if you have a better solution!
Thanks

pcambra’s picture

agileadam’s picture

If you've made the field required through the option in the pane configuration, you can simple add the red asterisk with a hook_form_alter() like:

/**
 * Implementation of hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'uc_cart_checkout_form':
      $form['panes']['uc_termsofservice_agreement_checkout']['tos_agree']['#options']['agreed'] .= ' <span class="form-required" title="This field is required.">*</span>';
      break;
  }
}

Please let me know if there's a better way to do this. It seems like a band-aid to me.

echoz’s picture

Thanks @keystr0k