21311 Posts in 5739 Topics by 2604 members
General Questions
SilverStripe Forums » General Questions » Select existing member instead of creating new (modeladmin)
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 233 Views |
-
Select existing member instead of creating new (modeladmin)

3 January 2012 at 6:05am
Hello all,
I have the following relationship
Class A <--- many_many ---> Member
and it is moderated using the ModelAdmin interface. Now when I create a new Class A object, I wish to select from the new tab 'Member' -> 'Add new Member' an existing Member from a dropdown or similar fashion. However, it shows the form to create a new member. How can I modify this behavior? I suggest I need to change getCMSFields_forPopup() function somewhere?
Any help is highly appreceated.
Friendly regards,
Maurice -
Re: Select existing member instead of creating new (modeladmin)

3 January 2012 at 10:35pm
This is the native way of doing it...
-
Re: Select existing member instead of creating new (modeladmin)

4 January 2012 at 4:03am
Thank you, that is a good start for me. Now I only still do not completely seem to get how to override the save/delete methods from the ComplexTableField. I know I have to override it, so I tried to create a new class:
class SpecialComplexTableField extends ComplexTableField {
}
class SpecialComplexTableField_Popup extends ComplexTableField_Popup {
function saveComplexTableFields() {
die("Notice I am here");
}
}However I seem to be wrong. What am I doing wrong? Because without changing this, when I delete a row from the CTF, it also deletes the associated Member info!
Thanks in advance,
Maurice -
Re: Select existing member instead of creating new (modeladmin)

4 January 2012 at 4:10am
how to override the save/delete methods from the ComplexTableField
It's not something that is overridden, but you can "hook" into it...
http://doc.silverstripe.org/sapphire/en/topics/datamodel#onbeforewrite
-
Re: Select existing member instead of creating new (modeladmin)

4 January 2012 at 4:24am
Ah thank you, it is coming together now (trying to understand to deeper workings of silverstripe). Really enjoy it and thank you for the support.
Friendly regards,
Maurice
| 233 Views | ||
|
Page:
1
|
Go to Top |


