Copied to clipboard

Flag this post as spam?

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


  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 29, 2020 @ 15:09
    Huw Reddick
    0

    Customize Handler

    Is it possible to modify the built in Email Handler so it doesn't use the .Net mail for sending (we are not using the inbuilt mailing methods), if so where would I need to look to make the changes?

    Also, do you have a very basic example of implementing a datatype? We also use a custom captcha rather than reCaptcha so wanted to add that as a fieldtype also (it is just an image and text box with a js function).

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 29, 2020 @ 18:19
    Nicholas Westby
    100

    Before I respond, I'll make these assumptions: you are using the lastest version of Formulate (the one for Umbraco 8).

    Is it possible to modify the built in Email Handler so it doesn't use the .Net mail for sending (we are not using the inbuilt mailing methods), if so where would I need to look to make the changes?

    Sort of. One option would be to copy the existing email handler and customize it to your needs: https://github.com/rhythmagency/formulate/blob/v3.3.6/src/formulate.app/Forms/Handlers/Email/EmailHandler.cs

    Be sure to change the TypeId and TypeLabel.

    Another option would be to submit a pull request that moves the code that sends the email into a protected virtual method: https://github.com/rhythmagency/formulate/blob/v3.3.6/src/formulate.app/Forms/Handlers/Email/EmailHandler.cs#L333-L337

    That way, you would be able to subclass it and just modify that one function.

    One more option would be to subclass what's already there and just change the implementation of the HandleForm method. I'm not 100% sure that'll work (e.g., not sure if that method references any private functions/properties). Worth a shot though.

    Also, do you have a very basic example of implementing a datatype? We also use a custom captcha rather than reCaptcha so wanted to add that as a fieldtype also (it is just an image and text box with a js function).

    This explains that: https://www.formulate.rocks/articles/custom-field-types

    You might also want to refer to the existing implementation of the recaptcha field:

    You can also refer to the other field types (e.g., the text field might be useful to refer to, since it is very simple).

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 29, 2020 @ 21:15
    Huw Reddick
    1

    Yes, I'm using the latest, Thanks for the info and pointers, I will do some reading and see how I get on. The handler isn't so important, but will take a look at some point, for now I just implemented an api controller and am sending the data to that and processing the data and sending an email which works great.

    Now to work on the custom Captcha.

    Thanks for giving us a great component, for the basic forms my client wants it is very easy to use and configure.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 30, 2020 @ 15:12
    Huw Reddick
    0

    Hi,

    thanks for the pointers so far, but am abviously missing something :)

    my new field appears in the field selector and I can quite happily add it to the form, however when I try to view the form in the ui I get the following error

    The specified Formulate view could not be located on the file system.

    This occurs in renderform.cshtml, the viewpath is null, I assume it should have a template somewhere.

    Ignore that. it was me, I hadn't chosen the javascript responsive template.

    However my custom control does not appear on the form I just get an empty row/cell

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 30, 2020 @ 15:50
    Huw Reddick
    0

    I get this error in the javascript console, have I miss named something perhaps?

    Unable to find renderer for field of type BotcheckField

    'BotcheckField is the name of the cs class I created, but I think in the js files I call it just Botcheck, should the class name match?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 30, 2020 @ 15:56
    Nicholas Westby
    0

    Unable to find renderer for field of type BotcheckField

    Do you have some code like this:

    // Store the field renderer configuration on the window so Formulate can access it.
    let key = "formulate-plain-js-fields";
    window[key] = window[key] || [];
    window[key] = {
        key: "BotcheckField",
        renderer: Botcheck
    };
    

    Based on the instructions here: https://www.formulate.rocks/articles/custom-field-types

    That JavaScript should probably be referenced before the main Formulate JavaScript.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 30, 2020 @ 16:30
    Huw Reddick
    1

    tried a few combinations and now I'm getting something displayed :) Not exactly what I was expecting :D but getting there, thanks for all the help.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Nov 30, 2020 @ 17:33
    Huw Reddick
    1

    Once again, many thanks for all the advice, I am almost there now.

    Custom Captcha

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 30, 2020 @ 19:20
    Nicholas Westby
    0

    Nice work, looks like it's coming along well!

Please Sign in or register to post replies

Write your reply to:

Draft