mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #3219 from AntonyThorpe/patch-1
Update forms.md with additional example code in MyForm.ss
This commit is contained in:
commit
86e91b57bf
@ -286,8 +286,8 @@ define a custom template using a `forTemplate()` method on your Form class.
|
||||
of return value of `$this->class`, which in this case is *MyForm*. If the
|
||||
template doesn't exist, then it falls back to using Form.ss.
|
||||
|
||||
*MyForm.ss* should then be placed into your *templates/Includes* directory for
|
||||
your project. Here is an example of basic customization:
|
||||
*MyForm.ss* should then be placed into your *templates/Includes* directory for your project. Here is an example of
|
||||
basic customisation, with two ways of presenting the field and its inline validation:
|
||||
|
||||
:::ss
|
||||
<form $FormAttributes>
|
||||
@ -301,11 +301,19 @@ your project. Here is an example of basic customization:
|
||||
<div id="Email" class="field email">
|
||||
<label class="left" for="{$FormName}_Email">Email</label>
|
||||
$Fields.dataFieldByName(Email)
|
||||
<span id="{$FormName}_error" class="message $Fields.dataFieldByName(Email).MessageType">
|
||||
$Fields.dataFieldByName(Email).Message
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="Email" class="field password">
|
||||
<label class="left" for="{$FormName}_Password">Password</label>
|
||||
$Fields.dataFieldByName(Password)
|
||||
<% with $Fields.dataFieldByName(Password) %>
|
||||
$field
|
||||
<% if $Message %>
|
||||
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
|
||||
<% end_if %>
|
||||
<% end_with %>
|
||||
</div>
|
||||
|
||||
$Fields.dataFieldByName(SecurityID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user