Permalink
Browse files

BUGFIX Using separate template for readonly version of Textarea (main…

…ly to avoid SSViewer bugs, but also for more granular customisation)
  • Loading branch information...
1 parent a6148c3 commit 475f3764c32f6d60e9ee3058d026f1fabb8fce84 @chillu chillu committed Dec 21, 2011
Showing with 6 additions and 5 deletions.
  1. +4 −0 forms/TextareaField.php
  2. +1 −5 templates/forms/TextareaField.ss
  3. +1 −0 templates/forms/TextareaField_Readonly.ss
@@ -62,6 +62,10 @@ function Field($properties = array()) {
return parent::Field($properties);
}
+ function getTemplate() {
+ return ($this->isReadonly()) ? "{$this->template}_Readonly" : $this->template;
+ }
+
/**
* Performs a readonly transformation on this field. You should still be able
* to copy from this field, and it should still send when you submit
@@ -1,5 +1 @@
-<% if isReadonly %>
-<span id="$ID" class="readonly$extraClass" name="$Name"><% if Value %>$Value<% else %><em>(<% _t('NONE', 'none') %>)</em><% end_if %></span>
-<% else %>
-<textarea id="$ID" class="textarea$extraClass" name="$Name" rows="$Rows" cols="$Cols"<% if isDisabled %> disabled<% end_if %>>$Value</textarea>
-<% end_if %>
+<textarea id="$ID" class="textarea$extraClass" name="$Name" rows="$Rows" cols="$Cols"<% if isDisabled %> disabled<% end_if %>>$Value</textarea>
@@ -0,0 +1 @@
+<span id="$ID" class="readonly$extraClass" name="$Name"><% if Value %>$Value<% else %><em>(<% _t('NONE', 'none') %>)</em><% end_if %></span>

0 comments on commit 475f376

Please sign in to comment.