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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Dropdownfield in DOM ?! Dropdown in Popup = Yes, Dropdown Content = No :(


Go to End


9 Posts   2178 Views

Avatar
benni91

Community Member, 72 Posts

30 July 2011 at 9:35am

Hi everyone,

i'm trying to build a "clients opinion" page, where clients can tell there opinion about a done project.
Now i got caught on the Dropdownfield in the DOM where you can choose the client and a person who's responsible for this project.
Booth of this Informations are stored in the ClientObject.

My problem is, that the dropdown field didn't get the content from the clientobject :/

You should access the whole thing over the HomePage.

can someone help me out?

here's the code

OpinionObject.php -> http://pastie.org/2291897
ClientObject.php -> http://pastie.org/2291894
HomePage.php -> http://pastie.org/2291883

THX :)

Avatar
benni91

Community Member, 72 Posts

2 August 2011 at 7:30am

No One ?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

2 August 2011 at 2:17pm

I'm unclear on what you're trying to do.. You didn't have any has_one relations set up for those drop downs.. you still have a has_many that isn't being used.. but this should at least get you started.

http://pastie.org/2306916

Avatar
benni91

Community Member, 72 Posts

3 August 2011 at 2:30am

Thx for the help.

I'll do the rest later @home. After Testing it i'll report my result :)

Avatar
benni91

Community Member, 72 Posts

3 August 2011 at 9:35am

Edited: 03/08/2011 10:39pm

Thx that works :)

but what if i got 2 dropdowns?

can i do it like this than:

	public function getCMSFields_forPopup() {
  		$map = array();
		if($set = DataObject::get("ClientObject")) {
		$map = $set->toDropdownMap('ID','Name');

  		$map2 = array();
		if($set2 = DataObject::get("OtherObject")) {
		$map2 = $set2->toDropdownMap('ID','Other');
	}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

4 August 2011 at 1:55am

Yup!

Avatar
benni91

Community Member, 72 Posts

4 August 2011 at 2:10am

so
$map and $set are just variables which i can rename however i want ?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

4 August 2011 at 6:06am

Yup!

Go to Top