Populate form fields

Options

Hi,

I'm aware it's possible to use “magic links” (URL parameters) to choose the membership and pre-select the gift, but is it possible to also prepopulate the name and address fields? Or perhaps somebody has done this with some custom JS?

thanks,

chris

Tagged:

Comments

  • Alex Wong
    Alex Wong ✭✭✭✭✭
    Ninth Anniversary Facilitator 4 Name Dropper Photogenic

    @Chris Gadd
    I'm not sure about membership forms, but I imagine it to be the same as Online Express registration and donation form. You can issue some JavaScript to assign values into the form field after the form has loaded. Pretty easy to do if you are somewhat familiar with webdev.

    Using developer tool on browser will help you identify the “id” of the field, and then it is just using JS to change that field's value to something else. For example, for a donation form, the “id” of the first name field in billing address section is bboxdonation_billing_txtFirstName, which you can change the value (populate the value) with anything you want by:

    document.getElementById("bboxdonation_billing_txtFirstName").value = "My First Name";

    This is pure JS code, so if you use any JS framework (i.e. jQuery), it will have easier syntax.

  • Thanks @Alex Wong. Yeah, sounds like a little JS is the way. Would be nice to have something off-the-shelf / supported but this'll do the job.

Categories