I have a CCK form attached with Profile and i am using them for people to register. The CCK has conditional field through Conditional Field's module, that is a selection menu of items, when the user will select the "other" item from the select list, a new text field show up for user input.
The form works perfectly as stand alone, but when joined to the profile through content profile module, the hidden text field is always visible no matter user chooses whichever selection.
There is a file upload field on the CCK form as well, and it is a compulsary field. When the CCK form is stand alone, the validation works perfect. When the form is joined with the Profile to use as a registration form, the file upload field looses the validations and no matter the field is empty and user submits the form, system accepts it without showing any validation error.

Comments

waqasnasir’s picture

For the first problem of file upload validation failure, someone on the drupal forum suggested the following fix and it has solved the problem.

Following code has to be added to content_profile_registration.module
in content_profile_registration_add_profile_form() around line 160.

<?php
  // Add form level validators but skip the first one (node-form-specific).
  array_shift($form_add['#validate']);
  foreach ($form_add['#validate'] as $callback) {
    $form['#validate'][] = $callback;
  }
?>

It works like a charm.

The conditional fields issue is still remaining , trying to find a solution of it ... if someone knows please share.

waqasnasir’s picture

OK the second problem is solved by modifying the module with the following condition at around line 308 .

function conditional_fields_form_alter(&$form, $form_state, $form_id) {
     case 'content_copy_import_form':
       $form['#submit'][] = 'conditional_fields_import';
       break;
    case 'user_register':
      conditional_fields_node_editing_form($form, $form_state);
      break;
   }