From fe4f0c92e24946af5662438b7332a4c5c1bee536 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 2 Oct 2012 00:02:17 +0200 Subject: [PATCH] Markdown line endings --- docs/en/topics/form-validation.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/topics/form-validation.md b/docs/en/topics/form-validation.md index a6a549537..ccd7906f9 100644 --- a/docs/en/topics/form-validation.md +++ b/docs/en/topics/form-validation.md @@ -64,13 +64,13 @@ Example: Validate postcodes based on the selected country (on the controller). public function submit($data, $form) { // At this point, RequiredFields->validate() will have been called already, // so we can assume that the values exist. - + // German postcodes need to be five digits if($data['Country'] == 'de' && isset($data['Postcode']) && strlen($data['Postcode']) != 5) { $form->addErrorMessage('Postcode', 'Need five digits for German postcodes', 'bad'); return $this->redirectBack(); } - + // Global validation error (not specific to form field) if($data['Country'] == 'IR' && isset($data['Postcode']) && $data['Postcode']) { $form->sessionMessage("Ireland doesn't have postcodes!", 'bad'); @@ -96,7 +96,7 @@ SilverStripe supports this by allowing to set custom attributes on fields. :::php // Markup contains TextField::create('MyText')->setAttribute('required', true); - + // Markup contains TextField::create('MyText') ->setAttribute('type', 'url') @@ -111,7 +111,7 @@ These are general purpose attributes, but can be used to hook in your own valida // Validate a specific date format (in PHP) // Markup contains DateField::create('MyDate')->setConfig('dateformat', 'dd.MM.yyyy'); - + // Limit extensions on upload (in PHP) // Markup contains $exts = array('jpg', 'jpeg', 'gif');