diff --git a/code/UserDefinedForm.php b/code/UserDefinedForm.php index dfeb57d..0e7d0b5 100755 --- a/code/UserDefinedForm.php +++ b/code/UserDefinedForm.php @@ -335,13 +335,14 @@ class UserDefinedForm_Controller extends Page_Controller { $fields = new FieldSet(); $required = array(); - if( !$this->SubmitButtonText ) + if(!$this->SubmitButtonText) { $this->SubmitButtonText = 'Submit'; - - foreach( $this->Fields() as $field ) { - $fields->push( $field->getFormField() ); - if( $field->Required ) - $required[] = $field->Name; + } + foreach($this->Fields() as $field) { + $fields->push($field->getFormField()); + if($field->Required) { + $required[] = $field->Name; + } } if(!isset($_SERVER['HTTP_REFERER'])) { diff --git a/code/editor/EditableFileField.php b/code/editor/EditableFileField.php index 5cb9124..e31872e 100755 --- a/code/editor/EditableFileField.php +++ b/code/editor/EditableFileField.php @@ -27,11 +27,10 @@ class EditableFileField extends EditableFormField { static $plural_names = 'File fields'; function getFormField() { - if($field = parent::getFormField()) + if($field = parent::getFormField()) { return $field; - return new FileField($this->Name, $this->Title, $this->getField('Default')); - // TODO We can't use the preview feature because FileIFrameField also shows the "From the file store" functionality - //return new FileIFrameField( $this->Name, $this->Title, $this->getField('Default') ); + } + return new FileField($this->Name, $this->Title, $this->getField('Default')); } function getSimpleFormField(){ diff --git a/code/editor/SubmittedFileField.php b/code/editor/SubmittedFileField.php index 90d09f5..dd288be 100755 --- a/code/editor/SubmittedFileField.php +++ b/code/editor/SubmittedFileField.php @@ -9,5 +9,23 @@ class SubmittedFileField extends SubmittedFormField { "UploadedFile" => "File" ); + /** + * Return the Value of this Field + * + * @return String + */ + function getValue() { + return ($this->UploadedFile()) ? $this->UploadedFile()->Title : ""; + } + + /** + * Return the Link object for this field + * + * @return String + */ + function getLink() { + return ($this->UploadedFile()) ? $this->UploadedFile()->URL : ""; + } + } ?> \ No newline at end of file diff --git a/templates/SubmittedFormReportField.ss b/templates/SubmittedFormReportField.ss index 45252b9..8829c2c 100644 --- a/templates/SubmittedFormReportField.ss +++ b/templates/SubmittedFormReportField.ss @@ -14,7 +14,7 @@ <% control FieldValues %> $Title - $Value + <% if Link %><% end_if %>$Value<% if Link %><% end_if %> <% end_control %>