Medical conditions section on regn form is now more flexible

This commit is contained in:
2015-07-23 20:25:21 +10:00
parent fa24cb3350
commit cdc2d84fe2
2 changed files with 86 additions and 37 deletions

View File

@@ -908,47 +908,65 @@ if (variable_get('booking_enable_passport', 0) == 1)
'#required' => FALSE,
'#states' => array(
'visible' => array(
':input[name="booking_dietary_check"]' => array('checked' => TRUE),
':input[name="booking_dietary_check"]' => array('checked' => TRUE),
),
),
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : ''
);
}
//the user is not allowed to enter data directly, so show them the instructions specified by the admin configuration options
else
{
$form['misc-areas']['booking_dietary'] = array(
'#type' => 'container',
'#children' => variable_get('booking_dietary_text_definition', "Please contact us to specify your dietary requirements."),
'#states' => array(
'visible' => array(
':input[name="booking_dietary_check"]' => array('checked' => TRUE),
'visible' => array(
':input[name="booking_dietary_check"]' => array('checked' => TRUE),
),
),
),
);
}
$form['misc-areas']['booking_medical_conditions_check'] = array(
'#type' => 'checkbox',
'#title' => t('I have special medical condition(s), including allergies'),
'#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0
);
$form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'textarea',
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
'#cols' => 60,
'#rows' => 5,
'#resizable' => FALSE,
'#required' => FALSE,
'#states' => array(
'visible' => array(
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
if (variable_get('booking_enable_medcond', 0) == 1)
{
$form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'textarea',
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
'#cols' => 60,
'#rows' => 5,
'#resizable' => FALSE,
'#required' => FALSE,
'#states' => array(
'visible' => array(
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
),
),
),
'#attributes' => array('maxlength' => 1000),
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '',
);
'#attributes' => array('maxlength' => 1000),
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '',
);
}
//the user is not allowed to enter data directly, so show them the instructions specified by the admin configuration options
else
{
$form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'container',
'#children' => variable_get('booking_medcond_text_definition', "Please contact us to specify your dietary requirements."),
'#states' => array(
'visible' => array(
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
),
),
);
}
//inserting is not true, so give the admin the textfield for entering/viewing data for dietary and medical conditions
} else {
$form['misc-areas']['booking_dietary'] = array(
'#type' => 'textfield',
@@ -957,11 +975,15 @@ if (variable_get('booking_enable_passport', 0) == 1)
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : ''
);
$form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'textfield',
'#title' => t('Please list any medical conditions we need to be aware of.'),
'#maxlength' => 120,
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
);
'#type' => 'textarea',
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
'#cols' => 60,
'#rows' => 5,
'#resizable' => TRUE,
'#required' => FALSE,
'#attributes' => array('maxlength' => 1000),
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '',
);
}
if (variable_get('booking_enable_roommate', 0) == 1)