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.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

DropdownFIeld not create on backend form ?

Go to End



Community Member, 3 Posts

19 December 2012 at 2:57pm


I want use a DropdownField input which values are generated from a dynamically table records. So I create a method to generate array for my dropdown value.

I set the field data type to Int ( usually its Enum for static values ). I do the dev/build and ?flush=all, but in my backend form it's show a text input and there is no error message.

I have no idea, why my dropdown automatically change to text input ?? I need help.

Here is my code :


class Cust_UUKategori extends DataObject {
	static $db = array(
		'kategori' => "Varchar(100)"
class Perundangan extends DataObject {
  public static $db = array(
    'Title' => 'Varchar(100)',
	'Category' => 'Int',
    'Subject' => 'Text'
  // One-to-one relationship with video files and video list page
  public static $has_one = array(
    'DocFile' => 'File',
	'PerundanganListPage' => 'PerundanganListPage'
  // Summary fields
  public static $summary_fields = array(
    'Title' => 'Produk Hukum',
    'Category' => 'Kategori',
    'Subject' => 'Tentang'
  public function getCMSFields_forPopup() {
	$titleField = new TextField('Title', 'Judul Produk Hukum');
	$subjectField = new TextareaField('Subject', 'Tentang');
	$aryCat = $this::getmap_uukategori();
	$catField = new DropdownField('Category', 'Kategori', $this::getmap_uukategori());		// new TextField('Category', 'Kategori');
    // Video file field
    $docField = new UploadField('DocFile', 'Upload PDF');
    $docField->allowedExtensions = array('pdf');
    // Name, Description and Website fields
    return new FieldList(
  public static function getmap_uukategori() {
	$Data = DataObject::get('Cust_UUKategori');

	foreach($Data as $row) {
		$ret[$row->ID] = $row->kategori;
	return $ret;

I've attatch screenshot to.

Attached Files