I'm using Meteor Autoform.
Demo site, liable to disappear at any time: http://exmp-eat-46040.euw1.nitrousbox.com/form
I have a Postcode/Address Form with a <SELECT> giving street addresses that the user can select.
I have other <INPUT>s for House Number, Street Name, City etc.
When the user selects their address from the <SELECT> I use jQuery to poke the address details into the various <INPUT>s
When the user doesn't select an address I clear down all the inputs:
Template.addressSelect.events({
'change #addressSelect': function(e) {
if ($(e.target).val()=='none') {
// no address slected, clear the other fields
$('input[name="curflat_name"]').val('');
$('input[name="curhouse_name"]').val('');
$('input[name="curhouse_no"]').val('');
$('input[name="curstreet_name"]').val('');
$('input[name="curcounty"]').val('');
$('input[name="curtown"]').val('');
$('input[name="curcity"]').val('');
}
} // change #addressSelect
});
Scenario
- The user DOESN'T select any Address and they click my form's Submit button.
- Autoform displays error messages for the missing required fields.
- The user selects an Address and I populate the
<INPUT>s - The error messages are still shown
Question
How do I clear down any Autoform generated Validation Errors? Or how do I trigger Autoform to run it's form validation after I have poked good data into the form fields?