I added fields mobile no,landline no, using the below code to the form which i created with webform module. when i fill the fields along with two added fields and submit them .i cannot find the two added field in results.how can i make them appear in results.

function search_enhance_form_alter(&$form, $form_state, $form_id) {

if($form_id == 'webform_client_form_2') {
  $form['mobile no'] = array(
  '#type' => 'fieldset',
  '#title' => t('mobile no'),
  '#collapsible' => TRUE,
  '#weight' => 30,
$form['mobile no']['text'] = array(
  '#type' => 'textfield',
  '#description' => t('This is a test to see the form_alter hook in action1.'),

$form['text'] = array(
  '#type' => 'textfield',
  '#description' => t('This is a test to see the form_alter hook in action.'),
  '#title' => t('land line no'),
  '#weight' => 10,
  • 2
    Have you considered adding those fields through the user interface instead of in custom code? Then all the data saving is handled for you. Based on the code example you provided I would think you don't need custom code.
    – rooby
    Commented Nov 25, 2014 at 9:10

1 Answer 1


first create submit button

$form['submit_button'] = array(
                '#type' => 'submit',
                '#value' => t('Click Here!'),

when you create submit it calls this function and feilds submitted or updated to your database

function form_try_form_submit($form, &$form_state) 
                echo '<pre>';
                echo '</pre>';
                        'phone' => $form_state['values']['phone']
  • The OP is altering an existing form. There is not need to add another submission button to the form, since there is one already. Plus, the OP's problem is not seeing the added form fields in the form.
    – apaderno
    Commented Nov 25, 2014 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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