Quantcast
Viewing latest article 11
Browse Latest Browse All 27

Re: validate on a button click event rather than onSubmit

Hi Greg,

Right, inline validation would work nicely I think.

The bit that confuses me in the code that is generated is that in my markup I have a button like this
<button id="repayment_calculator_submit" type="submit">Calculate</button>
but after calling myForm.render(); it changes to this <button id="repayment_calculator_submit-field" class="field">Calculate</button>

The problem for me is that I have an event listener for the onSubmit that looks like this

function calculateMortgageRepayment(e) {
e.preventDefault();
...
// Use form field contents to do calculation and show result
...
}

So this now isn't called and my Calculate button doesn't work.

How should I get around this?

Thanks,
Nick

Viewing latest article 11
Browse Latest Browse All 27

Trending Articles