1
 function gng_unsubscribe_form($form,&$form_state) {
 $form['email'] = array(
 '#title' => 'Email',

'#type' => 'textfield',
 );
 $form['submit']=array(
 '#type'=>'submit',
 '#value'=>t('Unsubscribe'),
 '#prefix' => '<div class="btn-area">',
 '#suffix' => '</div>'
 );
 return $form;
 }

For a particular field I can add custom class using #prefix and #suffix, is there a way to add wrapping div around whole form?

2

According to the Form API Reference, #prefix & #suffix are valid properties of the form element, so you should be able to:

$form['#prefix'] = '<div class="some-class">';
$form['#suffix'] = '</div>';
0

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.