On a community website i'm running, users can signup for events.
Every user is allowed to bring up to 20 people to the event as long as they specify with how many they wil attend. So far no problem.

I would like to add a field that displays not the number of users that will attend, but how many people will attend (handy for catering) in total.

I tried to use views calc table but the number in the "signup_form_data" is formatted as text and the view can only calculate integers.

Any suggestions?

here's the code i use in signup_form.inc

$form['signup_form_data']['#tree'] = TRUE;

  $form['signup_form_data']['Naam'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#size' => 40, '#maxlength' => 64,
    '#required' => TRUE,
  );
  
  $form['signup_form_data']['Aantal personen'] = array(
    '#type' => 'select',
    '#title' => t('Aantal personen'),
    '#default_value' => t('1'),
    '#required' => TRUE,
	'#options' => array(
            '1' => t('1'),
            '2' => t('2'), 
            '3' => t('3'), 
            '4' => t('4'),
            '5' => t('5'), 
            '6' => t('6'), 
            '7' => t('7'),
            '8' => t('8'), 
            '9' => t('9'), 
            '10' => t('10'),
            '11' => t('11'), 
            '12' => t('12'), 
            '13' => t('13'), 
            '14' => t('14'),
            '15' => t('15'), 
            '16' => t('16'), 
            '17' => t('17'),
            '18' => t('18'), 
            '19' => t('19'), 
            '20' => t('20')
        )
    );

Comments

Ashford’s picture

Change your field to an Integer and include the minimum (1) and maximum (20) when you set up the field.

geert’s picture

Subscribing. This could help the following request: http://drupal.org/node/1121416