Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

When using DropdownField the output is hidden with inline CSS


Reply

356 Views

Avatar
kharmer

27 February 2013 at 6:19am Community Member, 8 Posts

Hi All,

I'm pretty new to Silverstripe so excuse me if this is obvious!

I am creating a custom view/form and from my custom controller I have the following:

$fields = new FieldSet(
new TextField('FirstName', '<span>*</span> First name'),
new TextField('Surname', '<span>*</span> Surname'),
new EmailField('Email', '<span>*</span> Email'),
new ConfirmedPasswordField('Password', '<span>*</span> Password'),
new TextField('Agentid', '<span>*</span> SAP ID'),
new DropdownField('AgentDistributor', '<span>*</span> Distributor', array('' => '-- Select relevant distributor','Distributor 1 --' => 'Distributor 1','Distributor 2' => 'Distributor 2'))
);

In the browser, all is fine for the each field except for the DropdownField. When the page is rendered the dropdown field is hidden from view. Using firebug I noticed that it has some inline CSS in the DIV that wraps around it (style="display: none; width: 0px;").

I have inherited this project on behalf of a client from another developer. The version we are running is 2.4.

Am I missing something or could it be that the previous devs added this for whatever reason?

Any pointers much welcomed.

Best regards,
K...