5541 Posts in 1738 Topics by 1224 members
|Go to End|
1 January 2009 at 12:12am
I am trying to grey out some fields in the CMS based on the selection of a dropdown above. So I have a drop down with home/away as options and then I have an away club address underneath which I want to be greyed out and uneditable if home is selected.
1 January 2009 at 4:48am
Let me know if you have any questions.
1 January 2009 at 4:49am
Also, if you're interested in using radio buttons instead, the SelectionGroup field is really easy to use. (the behaviour you see in a FileIFrame field, for instance)...
1 January 2009 at 8:04am Last edited: 1 January 2009 8:05am
thanks for the help
I think SelectionGroup souds like a great solution for me right now so I will leave the dropdown untill I have time to learn a bit of js.
I cant seem to find any documentation on the SelectionGroup and the API doc isnt incredibly clear on implementation, any chance you could post an example?
Once again, thanks
Oh and Happy new year! I think 2009 will be a good year for SS
1 January 2009 at 8:57am
I use it in ImageGalleryAlbum.php, if you have that handy.
$f->push(new SelectionGroup("Source", array(
"new//Create a new folder" => new HiddenField(""),
"existing//Use an existing folder" => new FieldGroup("",
new DropdownField("FolderID","",DataObject::get("Folder",null,"Title ASC")->toDropdownMap('ID','Filename'))
where the text before the // is the value of the radio button and after it is the label. Notice i use an empty hiddenfield, since in this case, clicking "use an existing folder" exposes nothing.
Also, if you plan to use this in a popup, you'll need to use the PopupSelectionGroup that i created for the image gallery.
2 January 2009 at 1:13am
mate your a legend that works perfectly!
I love adding details like that to the interface it really seems to add an extra level usability.
anyway thanks so much for your help
3 May 2009 at 3:40am
aram - Do you mind posting the full code for your form that you used to disable/enable fields based upon another fields selection value. I need to get this done, but would appreciate a more simple step-by-step explanation.
A link to see the live example would be great as well.
|Go to Top|