Altering the block

marcus178 - November 3, 2009 - 20:38
Project:MailChimp
Version:6.x-2.0-rc1
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Just wondering if there is a way I can alter the output in the block. At the moment it's displayed as a fieldset which isn't ideal, and I would like to limit it to just requiring the email address and not all the other fields and options.

#1

LouBabe - November 3, 2009 - 21:24
Status:active» closed

you can use hook_form_alter to change the form in any way you like. http://api.drupal.org/api/function/hook_form_alter/6

#2

marcus178 - November 4, 2009 - 08:27

Ok thanks. Sorry I'm still learning and I've nearly sorted it. The following code makes it just display the email field but I get an error when I submit.

$form['list_45b91236f8']['#type']=form;
$form['list_45b91236f8']['NAME']['#type']=hidden;
$form['list_45b91236f8']['GENDER']['#type']=hidden;
$form['list_45b91236f8']['AGE']['#type']=hidden;
$form['list_45b91236f8']['INTERESTS']['#type']=hidden;

The error is:

An illegal choice has been detected. Please contact the site administrator.

#3

marcus178 - November 4, 2009 - 08:33

Sorry ignore that, just found the answer

unset($form['list_45b91236f8']['#type']);
unset($form['list_45b91236f8']['NAME']['#type']);
unset($form['list_45b91236f8']['GENDER']['#type']);
unset($form['list_45b91236f8']['AGE']['#type']);
unset($form['list_45b91236f8']['INTERESTS']['#type']);

 
 

Drupal is a registered trademark of Dries Buytaert.