From 8690caecd0de2830191f9253b73a00d3401f16eb Mon Sep 17 00:00:00 2001 From: Shea Dawson Date: Sat, 13 Sep 2014 16:32:49 +1000 Subject: [PATCH] Update README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e131e20..24020a4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@ SilverStripe 3 ##Usage example ```php -// 1. Create a callable function that returns an array of options for the DependentDropdownField. When the value of the field it depends on changes, this function is called passing the updated value as the first parameter ($val) +// 1. Create a callable function that returns an array of options for the DependentDropdownField. +// When the value of the field it depends on changes, this function is called passing the +// updated value as the first parameter ($val) $datesSource = function($val){ if($val == 'one'){ // return appropriate options array if the value is one. @@ -22,7 +24,8 @@ $datesSource = function($val){ $fields = FieldList::create( // 2. Add your first field to your field list, $fieldOne = DropdownField::create('FieldOne','Field One', array('one' => 'One', 'two' => 'Two'), - // 3. Add your DependentDropdownField, setting the source as the callable function you created and setting the field it depends on to the appropriate field + // 3. Add your DependentDropdownField, setting the source as the callable function + // you created and setting the field it depends on to the appropriate field DependentDropdownField::create('FieldTwo','Field Two', $datesSource)->setDepends($fieldOne) ); ```