Copied to clipboard

Flag this post as spam?

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


  • Stephan 2 posts 82 karma points
    May 15, 2019 @ 23:09
    Stephan
    0

    How to create a custom handler

    I see how I can create the handler by using IFormHandlerType but how can I create the directive for the configuration? Can that be done without altering the Formulate source code?

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    May 16, 2019 @ 18:37
    Nicholas Westby
    100

    Yep. Here is some info on how to inject JavaScript into the Umbraco back office: https://our.umbraco.com/forum/developers/extending-umbraco/63379-Custom-CSSJavaScript-for-Umbraco-Backoffice

    Here's some code you can reference:

    Instead of doing template: formulateDirectives.get("handlers/sendDataHandler/sendDataHandler.html"), you'd do templateUrl: "/some-path/sendDataHandler.html".

    BTW, what kind of handler are you creating? I might be able to provide some tips on an easier alternative to creating your own handler.

  • Stephan 2 posts 82 karma points
    May 16, 2019 @ 18:44
    Stephan
    0

    At this time we are just looking into how everything works in regards to Formulate in order to understand how/if we can use it in our projects. One potential usecase we have for a custom handler is where there would be conditional logic to determine where data gets posted based on specific form field values for example.

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    May 16, 2019 @ 19:57
    Nicholas Westby
    0

    Gotcha.

    You can almost do that now. You can dynamically set form fields based on the value of other fields, and you can include those dynamic fields when sending data.

    The URL is currently part of the configuration screen (i.e., not dynamic). What you could do is submit a pull request to make it possible to set that URL to the value of a field selected in the configuration screen. Then you could use the existing "Send Data" handler to accomplish that same thing.

    Alternatively, you could submit a pull request that modifies the SendingData event so that the URL can be modified with an event handler: https://github.com/rhythmagency/formulate/blob/master/src/formulate.app/Forms/Handlers/SendData/SendDataHandler.cs#L364-L373

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies