Skip to content
This repository
Browse code

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

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

0 notes on commit 475f376

Please sign in to comment.
Something went wrong with that request. Please try again.