Copied to clipboard

Flag this post as spam?

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


  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Nov 24, 2020 @ 14:53
    Lee Kelleher
    0

    Umbraco Forms - Auto-populate fields with AJAX fetch

    Hey Umbraco Forms fans!

    Version numbers upfront: Umbraco v8.6.6, Umbraco Forms v8.5.5.

    I'm trying to figure out a good way of achieving the following...

    On my form, I have address fields (e.g. Address1, Address2, City, Postcode), my client would like the address fields to be auto-populated by a postcode lookup. I already have an API for the postcode lookup, (via JS/AJAX request).

    Does anyone know if there is an existing way to do this with Umbraco Forms? or should I be developing my own custom field type for this? or hacking around with JS until I can make it work?

    I've tried searching around to see if anyone else has tried this before, but my google-fu is failing me.

    Thanks in advance!

    Cheers,
    - Lee

    Note: I tried to post this question in the Umbraco Forms forum category, but it appears that all new questions are under the "Using Umbraco And Getting Started" category. ¯\_(ツ)_/¯

  • Matthew Wise 257 posts 1182 karma points MVP c-trib
    Nov 24, 2020 @ 15:16
    Matthew Wise
    1

    Hi,

    I would go with a custom field. That way you can include the JS as you need it.

    For working out which ones to populate you could create a mapping similar to how I do in https://github.com/Matthew-Wise/umbraco-forms-campaign-monitor. I have done similar since in v8 but its not somewhere I can link to :)

    Matt

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Nov 24, 2020 @ 16:43
    Lee Kelleher
    0

    Thanks Matt, that's most helpful!

    I thought I'd need to take the custom field-type approach, but wanted to see if/how anyone else had done it.

    I'll take a look at the way you've done the mapping, (in "listmapping.html"). Good inspiration, thank you!

    Cheers,
    - Lee

  • 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