1

私はSilverstripeにRecaptchaを実装しようとしていますが、すべて正常に機能していますが、キャプチャ情報が入力されていないとき。シルバーストライプへのRecaptchaの実装

誰も私にこの問題を解決する方法のいくつかの指示を与えることができますか?ありがとう。

これは、手順に従い、recaptchaとspamprotectionをインストールした後に行ったことです。

私は私のBookingFormPage.php

$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) 

おかげでたくさんの新しいRecaptchaField( 'MyCaptcha')を追加しました。

種類が サム

+0

ありがとうございます。ちょうど興味のない - あなたは再キャプチャモジュールを見ましたか:https://github.com/chillu/silverstripe-recaptcha私は2.4でそれを使いました。 –

+0

こんにちはシェーン、そうです。それはXerraの答えが働いているようだ、私は予約フォームにお尻にする必要があります提案に感謝します。 Cheers、S – grumpypanda

答えて

1

強制メッセージキャプチャ情報が

を満たしていないときに一つだけ私のフォームの上に示されていないだろう「キャプチャの質問を答えてください」あなたが意味するかについてそれは全く表示されませんでしたか?

マイテンプレートは、(CSSグリッドなどを含む)のようになります - エラーメッセージを表示すべき:

<div class="push_2 grid_15 formbackground"> 
    <div class="grid_4"> 
     <label for="recaptcha_response_field" class="right">Captcha*<br/><span>Bitte die Zeichen der Grafik in das Feld eingeben</span></label> 
    </div> 
    <div class="grid_9"> 
     $dataFieldByName(MyCaptcha) 
     <span class="message $dataFieldByName(MyCaptcha).MessageType">$dataFieldByName(MyCaptcha).Message</span> 
    </div> 
</div> 

がその助けをしていますか?

+0

こんにちはXeraa、bookingform.ssで提案したようにを追加しました。現在は動作しているようです。あなたの助けをありがとう。乾杯、S :) – grumpypanda

関連する問題