0

I need a form that has a radio buton field. The field must not hard coded. Options must created dynamicly. The form will be a block and get radio buton options from given chosed node field.

For example if the form in node 1, radio options comes from node 1's given field, and so on.

Can you give me any advice to accomplish this? (entity form, web forms, custom form etc?)

(Sorry for my poor English)

0

Personally, I would create a custom module with a custom form and block. You're gonna want to study up on the form api. You can pass variables to your form, which for you would be your node object.

The block is really easy, just use hook_block_info() to define your block, hook_block_view to define a subject and callback function, and then just define a callback.

Something like this:

function mymodule_block_info (){
   $blocks[0] = array(
      'info' => t('radio thing'),
      'cache' => do_stuff
    );
   return $blocks;
}

function do_stuff(){
    //where radio_form is the implementation of your form (make sure it has a param for the node
    drupal_get_form ('radio_form', $node)
    return $stuff
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.