Skip to content

Instantly share code, notes, and snippets.

@eunjae-lee
Created May 8, 2020 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eunjae-lee/61b6fec8136e51fe7f6cbd5900cf0a3e to your computer and use it in GitHub Desktop.
Save eunjae-lee/61b6fec8136e51fe7f6cbd5900cf0a3e to your computer and use it in GitHub Desktop.
attestation
function fill(selector, value) {
document.querySelector(selector).value = value;
}
function fillForm({
firstName,
lastName,
birthDate,
birthPlace,
address,
town,
postalCode,
reason, // "travail", "courses", "sante", "famille", "sport", "judiciaire", "missions"
}) {
fill('#field-firstname', firstName);
fill('#field-lastname', lastName);
fill('#field-birthday', birthDate);
fill('#field-lieunaissance', birthPlace);
fill('#field-address', address);
fill('#field-town', town);
fill('#field-zipcode', postalCode);
document.querySelector(`input[name=field-reason][value=${reason}]`).checked = true;
}
fillForm({
firstName: 'Eunjae',
lastName: 'Lee',
birthDate: 'dd/mm/yyyy',
birthPlace: 'Séoul, Corée du Sud',
address: 'blah blah',
town: 'Blah Blah',
postalCode: '12345',
reason: 'courses',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment