I have a number of different events that I want to have people sign up for. The additional information required is different depending on the type of event. Is it possible to have a number of pre-defined forms selectable when enbling the sign-on function for the node.

Comments

andrewm63au’s picture

Title: Customisable form per node » Customisable forms per node
cwyant’s picture

I'm no expert, and I'm sure there's a better way to do this, but I have a working solution in 7.x dev.
Create a taxonomy for your "options" (additional form elements such as number of attendees, additional info, food allergies, etc)
In your event content type, add this taxonomy field with checkboxes to select if you want to add the additional form elements or not.
In signup_form.inc, create a script to check which taxonomy ID(s) are present, then add the corresponding form elements.

This script collects TIDs for field "field_event_signup_fields" and stores them in array $result:

   $num = count($node->field_event_signup_fields['und']);
    $result = array();

  if ($num > 0) {
    for ($row = 0; $row < $num; $row++) {
    $result[] = $node->field_event_signup_fields['und'][$row]['tid'];
    }
}

Then create form elements for each option:

if (in_array('124', $result)) {
    $form['signup_form_data']['num_total'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of Attendees'),
    '#size' => 3, 
    '#maxlength' => 2);
    }

Again, I apologize for the elementary PHP logic, but I hope it helps.

andrewm63au’s picture

Thanks, I'll see if I'm up to editing scripts

andrewm63au’s picture

Issue summary: View changes

corrected typo