Jump to:

2012 Posts in 1438 Topics by 621 members

Form Questions

SilverStripe Forums » Form Questions » DropdownFIeld not create on backend form ?

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

Page: 1
Go to End
Author Topic: 445 Views
  • imanovski
    Community Member
    3 Posts

    DropdownFIeld not create on backend form ? Link to this post


    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
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.