Copied to clipboard

Flag this post as spam?

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


  • LeaTark 22 posts 123 karma points
    Feb 23, 2017 @ 17:44
    LeaTark
    0

    Form Name in Controller

    I think I've found where to add Analytics to the event on a successful submission but I'm not sure how to reference the name of the form.

    enter image description here

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Feb 23, 2017 @ 19:21
    Nicholas Westby
    100

    Assuming you have a vm variable like in this code sample: http://www.formulate.rocks/render-form

    Then you can get the form name from this C# property:

    var name = vm.FormDefinition.Name;
    

    Then you can output the name of the form into the JavaScript string you are referencing. You may have to do a bit of string escaping.

  • LeaTark 22 posts 123 karma points
    Feb 24, 2017 @ 08:58
    LeaTark
    0

    So simple. Thank you.

    Sometimes I overlook what's staring me in the face.

  • LeaTark 22 posts 123 karma points
    Jun 30, 2017 @ 08:05
    LeaTark
    0

    Is it possible to get the Configuration Name instead?

    Does vm contain that too?

    Thank you.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jun 30, 2017 @ 15:54
    Nicholas Westby
    0

    Is it possible to get the Configuration Name instead?

    It's possible, but not readily supported at the moment. For now, if you want to get the configured form information, you can see how the converter is currently doing that here:

    https://github.com/rhythmagency/formulate/blob/2c6b8328e1aae1ebdbe690ee5469ef1003a0ba8e/src/formulate.app/Converters/ConfiguredFormConverter.cs#L83

    // The persistence object responsible for access to configured forms.
    private IConfiguredFormPersistence ConfiguredForms { get; set; }
    /* ... */
    // Get the current configured form persistence object.
    ConfiguredForms = ConfiguredFormPersistence.Current.Manager;
    /* ... */
    // Get information about the configured form.
    var conForm = guid.HasValue ? ConfiguredForms.Retrieve(guid.Value) : null;
    

    That conForm variable has a Name property on it, which is what you're looking for.

    If you'd prefer it be more built-in, we can chat about having you submit a pull request to include the configured form name (we'd have to figure out the best way of going about that).

Please Sign in or register to post replies

Write your reply to:

Draft