Active
Project:
Views Custom Field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Mar 2011 at 17:43 UTC
Updated:
22 Mar 2012 at 12:04 UTC
In my views custom field I have php code that outputs a form.
$thenid = $data->nid;
module_load_include('inc', 'dummy_mod', 'dummy');
$output = drupal_get_form('dummy',$thenid);
print $output;
This code works the form is displayed and all the values are correct. But when I submit the form the output is always based on the data values from the first row off results. I am a novice, so sorry if this is a dumb question, but I could use some help
This is the code for the form.
function dummy(&$form_state, $thenid) {
$node = node_load($thenid);
$form = array();
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Show Message node Id is ').$form['nid']['#value'],
'#submit' => array('dummy_submit'),
);
return $form;
}
/**
* Submit handler for the dummy form.
*/
function dummy_submit($form, &$form_state) {
drupal_set_message(t('node id from form state is').$form_state['values']['nid']);
}
Comments
Comment #1
bneel commentedHi,
Did you find a solution ?
Ben
Comment #2
bneel commentedIt can be resolved following this : http://drupal.org/node/1474898#comment-5765006