I have a node/add form.Using hook_form_alter i have added a textfield and a ajax submit button.I do fecth data with that textfiled and button.
function hook_form_alter(&$form, &$form_state, $form_id) {
$form['textfield'] = array(
'#title' => t('Add Field'),
'#type' => 'textfield',
'#required' => true,
'#weight' => -1,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit Field'),
'#weight' => -1,
'#ajax' => array(
'wrapper' => 'node-form',
'callback' => 'submit_callback',
'effect' => 'fade'
),
);
}
and onsubmit of the ajax I am getting the values which I want. But now I want to add few fields of node/add form with the result of that ajax submit.I have got stuck for how to go further with the implementation for this.
Can anyone help me out & let me know how to do this?