我在銀條紋中創建了一個前端表單。它的工作原理是記錄數據,如果有任何錯誤,它會重新導向並不保存數據。然而,我面臨的問題是驗證信息無法正確顯示。當我使用$Form
變量在前端顯示錶單時,驗證和一切工作正常。我想要做的是使用<% control Form %>
控制表單的佈局。這是因爲表格的設計原因。銀條紋:自定義表單模板 - 驗證問題
這裏是我的代碼:
(Template.ss)
<% control Form %>
<form class="wrap" $FormAttributes>
<% if $Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
<% else %>
<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
<% end_if %>
<fieldset>
<div class="member-details col lg-mobile-12 tablet-6 sm-desktop-6 md-desktop-6">
<% if ModTest == 'false' %>
<div class="field wrap">
<% control $Fields.dataFieldByName(ClientName) %>
<label class="title">$Title</label>$Field
<% end_control %>
</div>
<% end_if %>
<div class="field wrap">
<% control $Fields.dataFieldByName(FirstName) %>
<label class="title">$Title</label>$Field
<% end_control %>
</div>
<div class="field wrap">
<% control $Fields.dataFieldByName(Surname) %>
<label class="title">$Title</label>$Field
<% end_control %>
</div>
<% if $Fields.dataFieldByName(Address) %>
<div class="field address wrap">
<% control $Fields.dataFieldByName(Address) %>
<label class="title">$Title</label>
<% end_control %>
<div class="address-fields wrap">
$Fields.dataFieldByName(Address)
$Fields.dataFieldByName(Suburb)
$Fields.dataFieldByName(State)
$Fields.dataFieldByName(PostCode)
</div>
</div>
<% end_if %>
<% control $Fields.dataFieldByName(Phone) %>
<div class="field wrap">
<label class="title">$Title</label>$Field
</div>
<% end_control %>
<% control $Fields.dataFieldByName(Email) %>
<div id="$HolderID" class="field wrap <% if $extraClass %> $extraClass<% end_if %>">
<label class="title" for="$ID">$Title</label>
$Field
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
</div>
<% end_control %>
</div>
<div class="password col lg-mobile-12 tablet-6 sm-desktop-6 md-desktop-6">
<div class="field confirmedpassword">
$Fields.dataFieldByName(Password)
</div>
</div>
$Fields.dataFieldByName(SecurityID)
</fieldset>
<div class="col lg-mobile-12 tablet-12 sm-desktop-12 md-desktop-12">
<% if $Actions %>
<div class="Actions">
<% loop $Actions %>
$Field
<% end_loop %>
</div>
<% end_if %>
</div>
</form>
<% end_control %>
謝謝。我會着眼於此。 – Dallby