Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Recaptcha Module Question

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 861 Views
  • bmc38119
    Community Member
    45 Posts

    Recaptcha Module Question Link to this post

    I got the Racaptcha Module working, however, I cannot seem to get the theme parameter to work properly. My code is below. Anyone else have this same problem?

    function GetInvolvedForm() {

    $recaptchaField = new RecaptchaField('MyCaptcha');
    $recaptchaField->jsOptions = array('theme' => 'clean'); // optional
          return new Form($this, "GetInvolvedForm", new FieldSet(
             // List the your fields here
             new LiteralField("literalfield","<div class=\"clearfix\" style=\"margin-bottom:20px;\">"),
             new CheckboxSetField("ContactTypeList","Please check the following areas for which you are contacting us:",
                Dataobject::get("ContactType")->toDropdownMap("Name", "Description")
             new LiteralField("literalfield","</div>"),
             new TextField("NameFirst", "First Name *"),
             new TextField("NameLast", "Last Name *"),
             new TextField("PhoneHome", "Home Phone *"),
             new TextField("PhoneCell", "Cell Phone"),
             new EmailField("Email", "Email *"),
             new TextField("Address", "Address"),
             new TextField("City", "City"),
             new DropdownField("State", "State", Dataobject::get("FormState")->toDropdownMap("StateName", "StateName"),$value = null,$form=null,$emptyOption="Select"),
             new TextField("ZipCode", "Zip Code"),
             new DropdownField("Province", "Province", Dataobject::get("FormProvince")->toDropdownMap("ProvinceName", "ProvinceName"),$value = null,$form=null,$emptyOption="Select"),
             new DropdownField("Country", "Country", Dataobject::get("FormCountry")->toDropdownMap("CountryName", "CountryName"),$value = null,$form=null,$emptyOption="Select"),
             new TextareaField("Comment", "Comment"),
             new HiddenField("GetInvolvedPageID", "", $this->ID)//,
             //new HiddenField ("Referrer", "", $_SERVER['HTTP_REFERER'])
          ), new FieldSet(
          // List the action buttons here
             new FormAction("process", "Submit")
          ), new RequiredFields(
          // List the required fields here: "Email", "FirstName"
       function process( $data, $form ) {
          $submittedForm = new Contact();
          //replace array commas with space after so string can return down to next line in reports
          //do not use carriage returns, will cause issues with csv export
          $submittedForm->ContactTypeList = str_replace(',', ', ', $submittedForm->ContactTypeList);

          //iterate through ContactTypeList array for print friendly in the email
          $printedContactTypeList = '<br/>';
          foreach ($data['ContactTypeList'] as $k=>$v) {
             $printedContactTypeList .= $v . '<br />';
          $data['ContactTypeList'] = $printedContactTypeList;

          //send notifcation email
          $From = $this->EmailNotificationFrom;
          $To = $this->EmailNotificationTo;
          $Subject = $this->EmailNotificationSubject;
          $email = new Email($From, $To, $Subject);
          //set template
          //populate template
          //send mail
           //return to submitted message

          $url = "/get-involved-thank-you/";

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.