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 /

Treemultiselect field in new admin area


Reply


7 Posts   1526 Views

Avatar
Mo

Community Member, 514 Posts

3 December 2009 at 7:38am

Hi All,

Quick question. I am trying to add a Treemultiselectfield to a new class that extends LeftandMain.

I have added it in getEditForm as so:

function getEditForm($id = null) {
   $fields = new FieldSet(
      new HiddenField('ID','id #',$id),
      new TextField('MenuTitle', _t('MenuAdmin.MENUTITLE','Menu Title')),
      new TextField('MenuSlug', _t('MenuAdmin.MENUSLUG','Menu Slug')),
      new TreeMultiselectField('Pages','Pages in Menu','SiteTree')
   );
}

The box shows, but the functionality doesnt work. Do I need to include any additional JavaScript to make this work outside of CMS_Main?

I am currently trying this using the latest 2.4 build, is it just something that is to do with that?

Cheers,

Mo

Avatar
Mo

Community Member, 514 Posts

3 December 2009 at 11:55am

Now tried this in 2.3, same exact thing.

Anyone got any ideas?

Mo

Avatar
Mo

Community Member, 514 Posts

19 December 2009 at 6:43am

No ideas on this anyone? The required Javascript appears to be loading, are they any requirements for the TreeMultiSelectField JS?

Mo

Avatar
MateuszU

Community Member, 89 Posts

22 December 2009 at 9:30am

Hey Mo,
You have probably checked that already, but are you getting any JS errors when loading that page? Another question is are you on dev or test mode?

Avatar
Arun

Community Member, 8 Posts

18 February 2010 at 8:40pm

Hey Mo,

I have created a new module near to Site Content, that is Advertisement. In this module i have created some fields for adding the advertisement. Here is the code

$fields = new FieldSet(
         new TabSet(   'Root',
            new Tab(_t('AdvertisementAdmin.ADVTDETAILS', 'Advertisement Details xXx'),
               new HiddenField('ID','id #',$id),
               new DropdownField('Advertiser', _t('AdvertisementAdmin.ADVERTISER','Advertiser * xXx'), $advertisermap),
               new TextField('AdTitle', _t('AdvertisementAdmin.ADTITLE','Ad Title xXx'), _t('AdvertisementAdmin.NEWADVERTISEMENT','New Advertisement xXx')),
               new TextareaField('Html', _t('AdvertisementAdmin.HTMLTEXT','Html/Text xXx'), 8, "", ""),
               new CheckboxField('Active', _t('AdvertisementAdmin.ACTIVE','Active xXx'), "1"),
               new TreeMultiselectField('Pages','Pages in Menu','SiteTree')
            )
         )
      );

So in the above code you can see that i am trying to include a TreeMultiselectField at the last. here i want to load the Site Tree Structure for multiple select. and i want to insert the selected ids in to the same table as ids are comma separated or in any other table with the advertisement id and the page id.

But in the TreeMultiselectField, it will show up the Site Tree content that i have created.

So what i need is, i have to show a TreeMultiselectField in the form and i need to multiple check the pages and insert in to the same table where advertisements add or in any other table for storing Added advertisement id along with the selected page ids.

Could any one help me for this... if so it would be very helpful to me.... any help is much appreciated.

Thanks and Regards,
Arun

Avatar
Mo

Community Member, 514 Posts

24 February 2010 at 1:28am

Hi Arun,

I still haven't been able to fix this myself. I have had to use a checkboxfield which lists top level pages for the time being as a work around.

I really don't get this error, all the JavaScript appears to be loaded fine, and there are no JavaScript errors in the console, so I don't understand why this functionality is playing up.

Anyone have any ideas?

Mo

Avatar
Mo

Community Member, 514 Posts

24 February 2010 at 1:42am

AHHA, I have finally managed to fix this. I was getting a JavaScript error from my tree ul in the left pain, that was apparently causing the TreeMultiselectField to not work. Now I have fixed the other error, it is working ok.

Is anything else on the page causing a JavaScript error Arun?

Cheers,

Mo