|
@@ -103,6 +103,11 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
|
|
// $form['#submit'][] = "materio_user_user_register_form_submit";
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ if( $form_id == "webform_client_form_11186" ){
|
|
|
+ // dsm($form, '$form');
|
|
|
+ $form['#validate'][] = "materio_user_webform_client_111186_validate";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function materio_user_user_register_form_submit($form, &$form_state){
|
|
@@ -125,6 +130,27 @@ function materio_user_user_register_form_submit($form, &$form_state){
|
|
|
// drupal_set_message(t('Welcome, you just join materiO\'! now you can choose the membership that\'s right for you, or !link', array('!link'=>$frontlink)));
|
|
|
}
|
|
|
|
|
|
+function materio_user_webform_client_111186_validate($form, &$form_state){
|
|
|
+ // dsm($form, 'form');
|
|
|
+ // dsm($form_state, 'form_state');
|
|
|
+ $values = $form_state['values']['submitted'];
|
|
|
+ if ($values['membership_options'] == 3) {
|
|
|
+ foreach ($values['collaborators'] as $coll_key => $coll) {
|
|
|
+ foreach ($coll as $field_key => $field_value) {
|
|
|
+ if($field_value == ''){
|
|
|
+ $human_field_name = $form['submitted']['collaborators'][$coll_key]['#title'] . " : " . $form['submitted']['collaborators'][$coll_key][$field_key]['#title'];
|
|
|
+ $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
|
|
|
+ // dsm($field_name, 'field_name');
|
|
|
+
|
|
|
+ form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
/**
|
|
|
* Implements hook_help().
|
|
|
*/
|