0

Modal in bootstrap

I am using modal to show up after clicking on submit form. But it is also showing even if user doesn't enter tha form data. The 'required' attribute is also not stopping it. https://code.sololearn.com/WUicWzE7aGOr/?ref=app

23rd Jul 2020, 4:15 AM
harshit
harshit - avatar
5 Respostas
+ 3
harshit You have to open Bootstrap modal when form validate all fields. Use this $("#myModal").modal('show'); to open Bootstrap modal. See here I have done some small changes https://code.sololearn.com/Wt5WCBdg2577/?ref=app
23rd Jul 2020, 4:34 AM
A͢J
A͢J - avatar
+ 2
harshit If you use form action then you can't open modal because form action submit your data to server then refresh the whole page. So I will suggest submit data to the Server using Ajax or JSON. Problem with form action is it refresh your whole page after submitting data to server. So in this case you can't open modal. To avoid this problem Ajax and JSON came as a feature. Ajax and JSON avoid to refresh whole page means you can submit data without refreshing whole page.
23rd Jul 2020, 6:51 AM
A͢J
A͢J - avatar
+ 1
harshit If you are using pageclip then open Bootstrap modal when you get response from server side. Do not open through button. pageclip provide both option. You can submit data via form or front-end JavaScript.
23rd Jul 2020, 8:26 AM
A͢J
A͢J - avatar
0
AJ #L1G3 what if I have an action to submit the form on a server ?
23rd Jul 2020, 6:22 AM
harshit
harshit - avatar
0
AJ #L1G3 but I have used a form service called pageclip.
23rd Jul 2020, 8:06 AM
harshit
harshit - avatar