Skip to content

Simple dropdown field which displays a text field when 'Other' is selected. Great for Honorifics selects.

License

Notifications You must be signed in to change notification settings

Leapfrognz/alternative-field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silverstripe Alternative-field Module

Introduction

Simple dropdown field which displays a text field when 'Other' is selected. Great for Honorific selects.

How to use

Add the dropdown options to the _config/AlternativeFormField.yml file.

You can also edit the empty string for the dropdown and the label for the 'other' field in the yml.

Requirements

SilverStripe 3.0 or higher is required.

Example

<?php

	public function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->addFieldsToTab("Root.Whatever", array(
			AlternativeFormField::create('Honorific', 'Honorific'),
			TextField::create('FirstName', 'First name'),
			TextField::create('Surname', 'Last name')
		));

		return $fields;
	}

About

Simple dropdown field which displays a text field when 'Other' is selected. Great for Honorifics selects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published