21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 820 Views |
-
Update Field with another.

12 December 2009 at 11:32am
Ok, what I would like to do is automatically update the [Content] field with data from two other CMS fields called [OrphanageName] and [Gender].
This is so that these items will be searchable by the Silverstripe search module.
Any assistance would be appreciated
-
Re: Update Field with another.

12 December 2009 at 8:06pm
try adding something like this to your page class:
function onBeforeWrite(){
$this->Content = $this->OrphanageName . ' ' . $this->Gender;
parent::onBeforeWrite();
}i didnt test the code, but it should be close... this will always overwrite Content by the way.
-Chris -
Re: Update Field with another.

12 December 2009 at 11:25pm
Excellent - that works really well.
Do you also know how I can also run a search as an AND rather than an OR??
For example, if I search for Male Mynamar - I still get all females showing from Mynamar.
Any help would be great.
Thanks
-
Re: Update Field with another.

15 December 2009 at 4:18am
not too sure on that one.. you probably will have to extend SearchForm.. theres also an advanced search form class but i've never worked with that, so perhaps it already exists?
| 820 Views | ||
|
Page:
1
|
Go to Top |

