Come ricaricare un form con '#type' => 'radios' ?

3 contenuti / 0 new
Ultimo contenuto
Come ricaricare un form con '#type' => 'radios' ?

Ciao a tutti, sto sviluppando uno script da un modulo commerce: il problema consiste nel fatto che l'utente finale non vuole la select con il bottone a fianco la delle radio che al click fanno il submit del bottone!

Come richiamare il submit assieme al form alter con un solo click di selezione sul pagamento?
Grazie in anticipo a chiunque mi da un suggerimento!

Ecco il codice nativo, tanto per dare un'idea:

<?php
$form
['ec_receipt']['buttons'] = array(
         
'#prefix' => '<div id="payment-buttons" class="ec-inline-form">',
         
'#suffix' => '</div>',
         
'#weight' => -9,
      );
     
$form['ec_receipt']['buttons']['select_payment_type'] = array(
         
'#type' => 'select',
         
'#title' => t('Select payment method'),
         
'#default_value' => $txn->payment_method,
         
'#options' => $options,
         
'#access' => count($options) >= 1,
      );
     
$form['ec_receipt']['buttons']['receipt_submit'] = array(
         
'#type' => 'submit',
         
'#value' => t('Select payment method'),
         
'#access' => count($options) >= 1,
         
'#submit' => array('ec_receipt_checkout_alter_rtype'),
         
'#ahah' => array(
             
'path' => 'checkout/ajax/rtype',
             
'wrapper' => 'ec-receipt-form',
             
'method' => 'replace',
          ),
      );
?>

Devo ottenere le radio che al onclick ricarica il form
<?php
$form
['ec_receipt']['buttons']['select_payment_type'] = array(
      
'#type' => 'radios',
      
'#title' => t('Select payment method'),
      
'#default_value' => $txn->payment_method,
      
'#options' => $options,
      
'#prefix' => '<div><p>&nbsp;</p>',
          
'#suffix' => '</div>',
      
'#name' => 'radios_payment_type',
           
'#ahah' => array(
             
'path' => 'checkout/ajax/rtype',
             
'wrapper' => 'ec-receipt-form',
             
'method' => 'replace',
          ),
          
'#attributes' => array('onclick' => "location.href="link-che-non-submitta"'),
    );
?>

Vedi immagini alegate.

NB: onclick this.form.submit() non funziona perchè il submit va a chiamare ec_receipt_checkout_alter_rtype e non il form corrente

Ciao e grazie in anticipo

Drupal Version:

Potresti includere un file js con una funzione che al click faccia entrambe le operazioni (se ho capito cosa vuoi fare).

Sinceramente non mi piace come soluzione ma non mi viene in mente nulla di meglio...

Proverò con il form ahah, grazie comunque se qualcuno ha idee ben vengano, tutti le potranno usare!