Skip to main content

How do I combine three prefilled fields to auto-fill a single field?

Hi, if I have fields that are saved and prefilled from a member account, but then have a feature that combines the fields and automatically pre-fills am I able to do that? How would I do that? I know how to do it with one field on custom attributes pre-filled, but would like to combine 3 fields and auto fill one.

14 comments

  • Julian Galluzzo
    Julian Galluzzo

    What would the output of this be?

    Would the 3 fields fill into this one field and then when the form is submitted, they would then update this new field while leaving the other 3 fields alone?

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    yes they would fill that one field, but doesn't update the field it actually runs a script on the field that is autofilled

    this is what it powers

    just incentivizing users to create an account so its autofilled is where I'm at

    0
  • Julian Galluzzo
    Julian Galluzzo

    so you would only want the address field to populate here, and you wouldnt want it updating anything in Memberstack?

    And just to confirm, this would be autofilled, but a user can then go and type any address they want, replacing the autofill?

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    yes, correct

    0
  • Julian Galluzzo
    Julian Galluzzo

    OK, gonna look into that for you now and see what i can do

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    sweet i imagine it's actually pretty simple using some javascript and calling the field

    with some formula that concats them

    i just wanted to post on here before i spent the time to figure it out if anyone had done already

    0
  • Julian Galluzzo
    Julian Galluzzo

    I did it! https://www.loom.com/share/ae67676876a14ca4a61157dca362467a

    Here's a read only https://preview.webflow.com/preview/combine-fields?utm_medium=preview_link&utm_source=[…]024a72e1de&pageId=642695cb49a5ed031a4a0518&workflow=preview

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    awesome similar solution i was thinking of

    0
  • Julian Galluzzo
    Julian Galluzzo

    On my end, all works perfect! Ideally these would pull directly from memberstack instead, but the code bloat with the extra fields is minimal so its all good

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    Julian Galluzzo seems preview is broken?

    0
  • Julian Galluzzo
    Julian Galluzzo

    https://webflow.com/made-in-webflow/website/combine-fields

    0
  • Timothy Makalinao
    Timothy Makalinao OP

    just implemented

    it works great

    Thanks so much

    0
  • Julian Galluzzo
    Julian Galluzzo

    No problem! Glad to hear it, let me know if anything else comes up 😃

    0
  • Timothy Makalinao
    Timothy Makalinao OP
    var totalAddress = '';

    // Check if all fields have values, then concatenate them into the total address if (streetAddress) { totalAddress = streetAddress + ', ' + city + ', ' + zipCode; }

    I made a small tweak to make the field empty

    if streetAddress isn't filled

    so that the commas don't show up

    if not member where at least street address is required

    thanks mate!

    0

Please sign in to leave a comment.

Sitemap