ENHANCEMENT Allow setting of the legend value in the Form template by use of Form->setLegend('my legend')

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67422 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-12-04 03:27:59 +00:00 committed by Sam Minnee
parent 5f7f762f7a
commit 33960f1af3
2 changed files with 29 additions and 2 deletions

View File

@ -63,6 +63,15 @@ class Form extends RequestHandler {
*/
protected $target;
/**
* Legend value, to be inserted into the
* <legend> element before the <fieldset>
* in Form.ss template.
*
* @var string
*/
protected $legend;
protected $buttonClickedFunc;
protected $message;
@ -456,7 +465,15 @@ class Form extends RequestHandler {
function setTarget($target) {
$this->target = $target;
}
/**
* Set the legend value to be inserted into
* the <legend> element in the Form.ss template.
*/
function setLegend($legend) {
$this->legend = $legend;
}
/**
* Returns the encoding type of the form.
* This will be either "multipart/form-data"" if there are any {@link FileField} instances,
@ -662,6 +679,16 @@ class Form extends RequestHandler {
function getRecord() {
return $this->record;
}
/**
* Get the legend value to be inserted into the
* <legend> element in Form.ss
*
* @return string
*/
function getLegend() {
return $this->legend;
}
/**
* Processing that occurs before a form is executed.

View File

@ -7,7 +7,7 @@
<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
<% end_if %>
<fieldset>
<legend></legend>
<legend>$Legend</legend>
<% control Fields %>
$FieldHolder
<% end_control %>