Silverstripe に Recaptcha を実装しようとしています。すべてうまく機能していますが、キャプチャ情報が入力されていない場合、「キャプチャの質問に答えてください」という必須メッセージがフォームの 1 つだけに表示されません。
この問題を解決する方法について誰か教えてもらえますか? ありがとうございます。
これは、手順に従ってrecaptchaとspamprotectionをインストールした後に行ったことです。
BookingFormPage.php に新しい RecaptchaField('MyCaptcha') を追加しました
$fields = new FieldSet(
$TourDropDown,
new TextField('FirstName'),
new TextField('LastName'),
new TextField('EmailAddress')
new DropdownField('People','People Travelling',$People),
new DropdownField('Accommodation','Accommodation Standard',$Accommodation),
new DropdownField('Rooms','How Many Rooms',$Rooms),
new DropdownField('Transport','Transport Option',$Transport),
new DropdownField('TransportSelfDrive','If self drive select grade',$TransportSelfDrive),
new TextField('FlightArrival','Flight Arrival Details'),
new TextField('FlightDeparture','Flight Departure Details'),
new DropdownField('LengthOfStay','Length of stay',$LengthOfStay),
new TextareaField('Comments'),
**new RecaptchaField('MyCaptcha')**
);
and I added
<div class="formHoizontal">
<div id="MyCaptcha" class="field recaptcha ">
$dataFieldByName(MyCaptcha)
</div>
</div>
to the BookingForm.ss
<form $FormAttributes class="threecolumnform">
<% 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="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_Tour">Tour</label>
$dataFieldByName(Tour)
</div>
</div>
<div class="clear"></div>
<div class="formHoizontal">
<div id="FirstName" class="field text">
<label class="left" for="$FormName_FirstName">First name</label>
$dataFieldByName(FirstName)
</div>
<div>
<label class="left" for="$FormName_LastName">Last name</label>
$dataFieldByName(LastName)
</div>
</div>
<div class="clear"></div>
<div class="formHoizontal">
<div id="EmailAddress" class="field email">
<label class="left" for="$FormName_EmailAddress">Email</label>
$dataFieldByName(EmailAddress)
</div>
</div>
<div class="clear"></div>
<div class="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_LengthOfStay">Length of stay</label>
$dataFieldByName(LengthOfStay)
</div>
</div>
<div class="clear"></div>
<div class="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_People">Number of Adults</label>
$dataFieldByName(People)
</div>
</div>
<div class="clear"></div>
<br />
<h4>Accommodation</h4>
<div class="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_Accomadation">Type</label>
$dataFieldByName(Accommodation)
</div>
<div class="field text">
<label class="left" for="$FormName_Rooms">Number of rooms</label>
$dataFieldByName(Rooms)
</div>
<div class="field text">
<label class="left" for="$FormName_RoomConfig">Room requirements</label>
$dataFieldByName(RoomConfig)
</div>
</div>
<div class="clear"></div>
<br />
<h4>Transport</h4>
<div class="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_Transport">Type</label>
$dataFieldByName(Transport)
</div>
<div>
<label class="left" for="$FormName_TransportSelfDrive">If self drive select grade</label>
$dataFieldByName(TransportSelfDrive)
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div>
<div class="field text">
<label class="left" for="$FormName_SightSeeing">Enter any sightseeing or activities you would like included</label>
$dataFieldByName(SightSeeing)
</div>
<div><h4>Sightseeing</h4></div>
</div>
<br />
<div class="formHoizontal">
<div class="field text">
<label class="left" for="$FormName_FlightArrival">Flight Arrival Details</label>
$dataFieldByName(FlightArrival)
</div>
<div class="field text">
<label class="left" for="$FormName_FlightDeparture">Flight Departure Details</label>
$dataFieldByName(FlightDeparture)
</div>
</div>
<div class="clear"></div>
<br /><br /><br />
**<div class="formHoizontal">
<div id="MyCaptcha" class="field recaptcha ">
$dataFieldByName(MyCaptcha)
</div>
</div>**
<div class="clear"></div>
<br /><br /><br />
<div class="formHoizontalTwoColumn">
<div class="field text">
<label class="left" for="$FormName_Comments">Extra Information</label>
$dataFieldByName(Comments)
</div>
</div>
$dataFieldByName(SecurityID)
どうもありがとう。
よろしくサム