opengovsg / FormSG

Form builder for the Singapore Government
https://form.gov.sg
Other
275 stars 84 forks source link

Address field #486

Open r00dgirl opened 4 years ago

r00dgirl commented 4 years ago

to dos

considerations

possibility

liangyuanruo commented 4 years ago

FYI, here are six fields provided by MyInfo today, two of which are optional:

    // 1. building name (if available),
    // 2. block/street number,
    // 3. street,
    // 4. floor + unit (if available),
    // 5. country
    // 6. postal
aniruddha-adhikary commented 3 years ago

This should be a composite field - meaning essentially it would render multiple form fields.

Fields

This, in theory, the following layout should be able to cater to most addresses.

  1. Country
  2. Postal Code
  3. Address Line 1
  4. Address Line 2
  5. City
  6. State / Province

Automation Flow

  1. When the user selects the Country, the form gets to be customized (i.e. Singapore specific postal code validation, showing/hiding the State field)
  2. When the user enters the postal code, and the country is Singapore, we could autofill the Blk and Street Names, City Name. Autofocusing on Address Line 2 for the Unit and Floor number. (OneMap)

Transforming from MyInfo

FYI, here are six fields provided by MyInfo today, two of which are optional:

    // 1. building name (if available),
    // 2. block/street number,
    // 3. street,
    // 4. floor + unit (if available),
    // 5. country
    // 6. postal
  1. Address Line 1 -> ${blk_number} ${street_name}
  2. Address Line 2 -> ${building_name}, ${floor_number}-${unit_number}}
  3. City -> ?
  4. State / Province -> ``
  5. Country -> ${country}
  6. Postal Code -> ${postal_code}