BUGFIX Using separate template for readonly version of Textarea (mainly to avoid SSViewer bugs, but also for more granular customisation)

This commit is contained in:
Ingo Schommer 2011-12-21 17:40:05 +01:00
parent a6148c33da
commit 475f3764c3
3 changed files with 6 additions and 5 deletions

View File

@ -62,6 +62,10 @@ class TextareaField extends FormField {
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

View File

@ -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>

View File

@ -0,0 +1 @@
<span id="$ID" class="readonly$extraClass" name="$Name"><% if Value %>$Value<% else %><em>(<% _t('NONE', 'none') %>)</em><% end_if %></span>