custom module form radios fields & ajax problem

us flag

I have a custom form, that iI develop on a custom module to get some fields from a content type with an entity reference.

All is good, I can get all information, and I can save the chosen value on a field of content type.

My problem is: why is it that the first input radio doesn't save and show me the max, but I have 0 on the field like a value.

My code to create the field of form:

'#type' => 'radios',
'#title' => $critere->title,
'#options' => $option_bareme,
'#default_value' => isset($machine_notation->field_note_machine['und'][0]['value']),
'#attributes' => array(
  'class' => array(
  // 'id' => array(
  //  $machine_nota_id['target_id']
  // ),
  'name' => array(
'#ajax' => array(
  'callback' => 'test_ajax_form_action',
  'wrapper' => $machine_nota_id['target_id'],
  'method' => 'replace',
  'effect' => 'fade',
  //'event' => 'change',
  'parameter' => array('idmachine'=> $machine_nota_id['target_id'])

And my code for saving with ajax without submitting, only by choosing the value:

$machnot = node_load($form_state['triggering_element']['#ajax']['parameter']['idmachine']);
$machnota = entity_metadata_wrapper('node', $machnot);
// $machnota->field_note_machine->set($form_state['triggering_element']['#value']);
$machnota->field_note_machine = $form_state['triggering_element']['#value'];

and finally my render and my problem:

enter image description here

I have checked the name of the input, also the ID and the value is not the same! It gives from 50 only 12 values, and the first input doesn't save and doesn't get the value back from the node.

Sorry for my bad english and thanks to all :)

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.