File upload ajax and Radio Buttons not cooperating in registration form I have enabled Profile 2 and profile Profile2 Registration Path modules on my site and have a really long registration form with lots of fields. I have some radio boxes and file upload fields also. The problem is when I upload a file without having selected a valid option for my mandatory radio box. IF the radio box is empty when I hit upload, the file gets uploaded and I get the error "illegal option, contact admin". After that the error keeps repeating if I try to remove the file.

In my reports I see


  Location  http://localhost:6600/sitename/el/file/ajax/profile_customer/field_cv/und/0/form-Q8VxLye65S3tYFkcHSwO9Z58dG7Mhv6jRWRBnIst46s
  
  Referrer  http://localhost:6600/sitename/el/customer/register
  
  Message   Illegal choice in Specialty element.


The Specialty element is my radio box. If I enter an option in the radio box before uploading the document everything works as it should! Removing the file is troublefree also. I am completely baffled with this. I’ve searched and found many issues with file upload and radio boxes values connected to ajax. Seems weird that this thing isn't working. Can't be the only one with files and radio boxes in his registration form! Any ideas/pointers on how to solve this irritating issue?
If I understand you right you'll need to write a small custom module to hook into the registration form using hook_form_alter(), and add the #limit_validation_errors property to the correct radio group. This should stop the validation from running on AJAX calls, but still let it run when the form is submitted.

The code might look something like this:

function MYMODULE_form_user_register_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['radio_button']['#limit_validation_errors'] = array();
}


It's quite likely that the particular radio group you're after will be buried in the nested $form array somewhere so you'll probably need to use the dpm() function (part of of the Devel module) to inspect the form and determine the correct element to alter.