Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hayden Tomas 6 posts 77 karma points
    Oct 09, 2020 @ 14:34
    Hayden Tomas
    0

    Hi guys

    I need a little of bit of help getting recaptcha to work with a contact form.

    So far I have managed to add the key to /App_Plugins/UmbracoForms/UmbracoForms.config

    I have installed the package to get the Google reCAPTCHA field to show

    So far so good,

    Now this is where I am stuck as I dont have much experience with the codebase

    With each form field there is an associated cshtml file that needs to be created

    So, if there is a field called Message then the original dev created a message.cshtml message and added some code to the file and the message box will display on the front end.

    For the most part, I have managed to copy these from form to form with minimal effort as they are basic fields.

    But I cannot find an example online which shows reCAPTCHA implemented in this manner.

    Can somebody help me with this issue.

    I am using umbraco forms 4.4.0 and my umbraco version is 7.5.8 and no I cannot upgrade :)

    so as an example

    the email.cshtml looks like this

    @model Umbraco.Forms.Mvc.Models.FieldViewModel
    @{
    UmbracoHelper uHelper = new UmbracoHelper(UmbracoContext.Current);}
    <div class="small-12 medium-8 columns">
    <input type="text" name="@Model.Name" id="@Model.Id" class="text" value="@Model.Value" maxlength="500"
    @{if (Model.Mandatory || Model.Validate) { <text> data-val="true" </text>   }}
    @{if (Model.Mandatory) { <text> data-val-required="@Model.RequiredErrorMessage" </text>   }}
    @{if (Model.Validate) { <text> data-val-regex="@Model.InvalidErrorMessage" data-regex="@Html.Raw(Model.Regex)" </text>   }}
    placeholder="@uHelper.GetDictionaryValue("ContactUs.Form.Email")" />
    </div>
    

    What would I change in here to just have a working recaptcha?

    I found this tutorial https://www.jondjones.com/learn-umbraco-cms/umbraco-7-tutorials/umbraco-security/how-to-add-a-recapture-within-your-umbraco-website/

    But the code example given does not work at all in my version

Please Sign in or register to post replies

Write your reply to:

Draft