1

I'm trying to autohide all my webform components after submission. I've tried to add an extra submit handler to the form, but no luck there.
The webform is posted by using AJAX (but nothing is shown in my Console).

Is there some module or hook I'm overlooking?

1 Answer 1

1

I managed to do so with a hook_form_FORM_ID_alter:

function mymodule_form_myformid_alter(&$form, &$form_state, $form_id) {
    if(!empty($form_state['input'])) {
      $items = array('name', 'firstname', 'zip', 'phone', 'email');

      foreach ($items as $value) {
        $form['submitted'][$value]['#type']     = 'hidden';
        $form['submitted'][$value]['#title']    = '';
        $form['submitted'][$value]['#required'] = 0;
      }
      $form['actions']['#type'] = 'hidden';
    }
  }

It's not the most clean way to do so, but it does the trick :)

Your Answer

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

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