React.js: submit form programmatically does not trigger onSubmit event

I have success with this. This triggers the handleSubmit upon clicking. Hope this helps.

<form
  onSubmit={this.handleSubmit}
  ref={ (ref) => { this.form = ref; } }
>
    <a onClick={ () => { this.form.dispatchEvent(new Event('submit')) } }>
        Validate
    </a>
</form>

Found from here: https://github.com/facebook/react/issues/6796

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)