N
N
Ninja Mate2016-03-30 02:03:08
JavaScript
Ninja Mate, 2016-03-30 02:03:08

How to preventDefault in React-bootstrap form? or get rid of full page reload on submit?

You need form validation, but you don't need a full page reload. How to get rid of it?
e.preventDefault in react function doesn't work. You can remove the form and just send the fields with the button, but then the validation disappears, but it is needed.

<form>//если ставим сюда onSubmit, валидация происходит, но страница перегружается
     <ButtonInput type="submit" onClick={()=>this.handleSubmit()} /> 
     //Если из кнопки убираем type="submit" валидация формы не идет
</form>

handleSubmit() in jQuery function with ajax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aves, 2016-03-30
@victorzadorozhnyy

We need to pass the event from the arrow function expression to the handleSubmit method

<ButtonInput type='submit' onClick={ e => this.handleSubmit(e) } />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question