I have a large list of event types and I allow multiple selection from taxonomy.

Could the Subscribe page be formattes with a checkbox group in place of taxonomies default list.

Novice members have a hard time selecting multiple categories whereas a list of checkboxes would make it easy for them

how do you rewrit this code?

foreach($vocs as $key => $voc) {
$form .= _taxonomy_term_select($voc->name, 'taxonomy', $selected, $key, t('Select the terms for which you wish to receive reminders via email.'), 1, NULL);
}

into something else?

foreach($vocs as $key => $voc) {
$group .= form_checkbox($lists->name, 'taxonomy', $selected, $key, t('Select the terms for which you wish to receive reminders via email.'), 1, NULL);
$form .= form_group(t('See list below, Testing reformat'), $group);

That code returms a single box with the top of the taxonomy tree

I also have events listed by ZipCode and want to limit sending events to members with a 100 mile radius.

Comments

nevets’s picture

Title: Two Items I need » Two Items I need - look at _taxonomy_term_select and location module

For the first part look at the _taxonomy_term_select() function (around line 752) for the section

  if (count($options) > 0) {
    foreach ($options as $option) {
      $select .= '<option value="'. $option['tid'] .'"'. (is_array($value) ? (in_array($option['tid'], $value) ? ' selected="selected"' : '') : ($option['tid'] == $value ? ' selected="selected"' : '')) .'>'. check_form($option['name']) .'</option>';
    }

    $size = min(12, count($options));

    return form_item($title, "<select name=\"edit[$name][]\"". ($multiple ? " multiple=\"multiple\" size=\"$size\"" : '') . ($extra ? " $extra" : '') .' class="'. _form_get_class('', false, _form_get_error($name)) ."\">$select</select>", $description, NULL, false, _form_get_error($name));
  }

The line with "option value" construction one option for the selection list (put together in the call to form_item
It sound like you want to make an checkbox (<input type=checkbox ...) instead of an option and return the string of checkboxes.

-----
For the zip code question you might want to look at the location module currently in development. I think this may help you (actually I hope so because I have a similiar need, just not there yet)

Steve

killes@www.drop.org’s picture

This feature request makes sense. I'd apply a patch if I get one.

killes@www.drop.org’s picture

Status: Active » Closed (won't fix)

This can be now achieved through hook_form_alter so you can write a contrib module for that..