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 4026 posts 15836 karma points MVP 13x 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 271 posts 1373 karma points MVP 5x 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 4026 posts 15836 karma points MVP 13x 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

  • keilo 568 posts 1023 karma points
    Sep 25, 2023 @ 11:24
    keilo
    0

    Hi Lee

    I am too looking for this with Forms. If you happen to recall how did it end up could you share the code ?

    cheers

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Sep 25, 2023 @ 15:54
    Lee Kelleher
    0

    Hi keilo, sorry to say that it was for a client project that I no longer have access to the source code, (and I can't quite recall how I went about coding it - given it was 3 years ago - a lot has happened since then, the cursed covid years!)

  • keilo 568 posts 1023 karma points
    Sep 25, 2023 @ 16:08
    keilo
    0

    hear you Lee!

    thought I would try my chance, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft