The "submit" event on forms in JavaScript

  Рет қаралды 115,250

dcode

dcode

Күн бұрын

Пікірлер: 98
@coffeeandvapes1308
@coffeeandvapes1308 4 жыл бұрын
Sometimes you can get stumped by the simplest of issues, and its sooo annoying looking for hours and every tut you watch doesn't seem to give what you KNOW is a simple answer to a simple problem. Your basic method just works! Thanks fella!!! Hope the lockdown isnt driving you nuts lol 👍
@dcode-software
@dcode-software 4 жыл бұрын
No worries mate!! It's going alright mate getting used to it slowly, all the best :)
@stringplayer999
@stringplayer999 4 жыл бұрын
A web dev named Dom? perfect.
@vinosamari
@vinosamari 4 жыл бұрын
😂😆
@ntantar
@ntantar 3 жыл бұрын
😂
@Ab-cj6gl
@Ab-cj6gl 3 жыл бұрын
😂😂😂
@SemyonTishchenko
@SemyonTishchenko 4 жыл бұрын
Thank you very much for this little tutorial. I tried to find a video like this for too long. I wish you good luck, man
@dcode-software
@dcode-software 4 жыл бұрын
No worries mate, glad you enjoyed it!
@rajpalsingh1736
@rajpalsingh1736 4 жыл бұрын
@@dcode-software hello sir i want to appears image on click on button can you help me please
@trytoo5167
@trytoo5167 3 жыл бұрын
Anyone else getting 405 error method not allowed? How to fix @dcode
@Dreku22
@Dreku22 3 ай бұрын
exactly what I was looking for, good stuff
@gamenesting5594
@gamenesting5594 2 жыл бұрын
i liked your video, because you deserve this. what your content in this video is the thing i don't find any where in the web
@thantzinwin7215
@thantzinwin7215 2 жыл бұрын
thank you so much sir , you know you remove one of my difficulties .
@dcode-software
@dcode-software 2 жыл бұрын
Glad to hear you got it done!
@larskra6387
@larskra6387 2 жыл бұрын
Nice answer to a simple question. Thanks!
@bumbledoge
@bumbledoge 3 жыл бұрын
damn the quality of this video! fkn subscribed !!!!
@dcode-software
@dcode-software 3 жыл бұрын
Thanks mate
@Models_plus18
@Models_plus18 9 ай бұрын
You are the best Boss.
@nagendra9092
@nagendra9092 5 жыл бұрын
Thank you, I had a question By taking multiple inputs in FORM like name, age, number, after clicking on submit it will appear on new page with name:xyz, number:123456. with edit option also can we make like this with only using java script. please make a video on this. thank you
@Barnardrab
@Barnardrab 3 жыл бұрын
How do you get FormData working with just JavaScript? I want to code in Node JS. When I pop the new FormData(myForm) in the parameter of a console.log, I get some obscure data that isn't helpful.
@nelsonantonio5870
@nelsonantonio5870 2 жыл бұрын
Thank you very much Sir!!!
@abdullahmanafikhi4438
@abdullahmanafikhi4438 2 жыл бұрын
thanks a lot , hope you get an enormous success in this field
@athraafaraj8387
@athraafaraj8387 2 жыл бұрын
I have a question, if i wanna to but counter of users submit the course for example, how can i do it? and what can I write to search about this task?
@ajwadmajed3551
@ajwadmajed3551 2 жыл бұрын
I followed this video EXACTLY. I get this error and i don't know what to do... Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') ... "MyForm.addEventListener("submit" , (e) => {}); " This line is where the error is ?!
@Stallion45
@Stallion45 Жыл бұрын
This works great..., but if I have multiple forms on a page how can I add event listeners to all forms? Say adding a Ajax-form class to all forms I want to add a listener to and then looping through them to add a listener to each one. Sounds simple, but when I try it my forms stop posting on submit.
@LGmediaGlobal
@LGmediaGlobal 2 жыл бұрын
Without the .php and using only JS... I'm still getting page refresh upon submit. No data capture. The getElementById is global scope. I have addEventListener with e.preventDefault(); AND I have e.preventDefault(); on the formHandler as well and page is still blinking.
@charlesbabbage6786
@charlesbabbage6786 3 жыл бұрын
Very Helpful. Thank you!
@tarunchelumalla007
@tarunchelumalla007 4 жыл бұрын
Thank you so so much bro 🙏 u helped me a lot bro . Good stuff 👍 keep up
@dcode-software
@dcode-software 4 жыл бұрын
No worries mate! 😁
@tarunchelumalla007
@tarunchelumalla007 4 жыл бұрын
@@dcode-software though I'm a beginner it matters the most so it's kind a big problem than usually it's situation where I'm gonna quit it 😂 . That's when I saw ur video I resolved in a minute that's makes me more happy 😊 Thank you bro 👍
@athraafaraj8387
@athraafaraj8387 2 жыл бұрын
thank you for your explaining, really amazing
@milofcrsdelije
@milofcrsdelije 3 жыл бұрын
Hello there, Wy am I getting a TypeError: myForm is null? The code is: const myForm = document.getElementById("myForm"); myForm.addEventListener("submit", (e) => { e.preventDefault(); console.log("Form is submitted"); }); Of course, the form has id myForm in html. I am doing a radio form type, but that souldn't be the problem. Thanks!
@luisavenancio625
@luisavenancio625 3 жыл бұрын
Thanks for this video! Super helpful!
@eyalshnitzerful
@eyalshnitzerful 6 жыл бұрын
Great video. Thanks
@prathmeshborse5221
@prathmeshborse5221 3 жыл бұрын
Working fine but form data is as it is...the form data on html page should disapper...give solution
@Chetan16jul
@Chetan16jul 3 жыл бұрын
We have JS code that fires on our thank you page, that we would like moved to our submit button on our form. so how we can do that
@confidential303
@confidential303 3 жыл бұрын
hi, I am looking for building a simple homepage, where I have a simple searchbox for google. how to implement that in a html ? I know basic html and I know how to make a inputbox but how do I redirect the input text into google searchbar? So it has to go essentially to Google.com
@FreeSkypeGenerator1
@FreeSkypeGenerator1 2 жыл бұрын
Thanks May i know which theme you are using It's looking good
@monkeydog8681
@monkeydog8681 3 жыл бұрын
how do you parser that var dump?. I mean when you do an sql querry like the one below and var_dump it while($row = mysqli_fetch_array($result)) { var_dump($row); } one the other page. I use console.log(JSON.parse(this.responseText) ); ^^^ that is an error but when I use log w/o parse it works. console.log(this.responseText) Like how?
@beasta75
@beasta75 3 жыл бұрын
thank you so my bro that worked fine
@venusirpuram4345
@venusirpuram4345 4 жыл бұрын
which font do you use and theme for the vscode
@IMMWICKED
@IMMWICKED 2 жыл бұрын
can you use onSubmit to do the same thing?
@veliea5160
@veliea5160 5 жыл бұрын
console is logging the entire page where i put ajax the request. it doesnt response the form values :(
@Wallabyinertia
@Wallabyinertia 3 жыл бұрын
Great informative video!
@dcode-software
@dcode-software 3 жыл бұрын
You're welcome
@chigo_e
@chigo_e 2 жыл бұрын
Hi, can you edit the title to say PHP instead of Javascript. It's quite misleading...good video nonetheless!
@JunkMailOfficial
@JunkMailOfficial 4 жыл бұрын
For my assignment, I got the error code on the first step, saying it cannot add read property of addEventListener of null... My teacher isn't the greatest at explaining and I feel lost in the course. Do you think you can point me in the right direction to deal with this problem? Thanks
@dcode-software
@dcode-software 4 жыл бұрын
Whatever you're using to select the element is wrong - whether it's getElementById or querySelector. Or it's because your script is included in the head of file and not at the end of body. It could also be helpful to watch my video on the DOMContentLoaded event.
@JunkMailOfficial
@JunkMailOfficial 4 жыл бұрын
dcode thank you! Will do!
@jatinnehlani1622
@jatinnehlani1622 3 жыл бұрын
How to reset the form after submitting it?
@juancarloshuanca2384
@juancarloshuanca2384 2 жыл бұрын
thanks :)
@moawiaab
@moawiaab 6 жыл бұрын
Thanks you.! create vedio 👍🎬
@dcode-software
@dcode-software 6 жыл бұрын
No worries mate
@strifetalk
@strifetalk 6 жыл бұрын
Dude, this VS Code theme looks amazing. What theme is it?
@salihefee
@salihefee 4 жыл бұрын
yea it is very good i want it too
@dcode-software
@dcode-software 4 жыл бұрын
Unfortunately I uninstalled this theme long ago... sorry guys!
@salihefee
@salihefee 4 жыл бұрын
@@dcode-software oof
@salihefee
@salihefee 4 жыл бұрын
@@dcode-software but I found an alternative
@ichra7com
@ichra7com 2 жыл бұрын
i need the actual code please
@lucianobrandao6217
@lucianobrandao6217 4 жыл бұрын
Thankss for informations =)))
@leslinks
@leslinks 4 жыл бұрын
what if i don't like to use AJAX and instead using normal procedural way in php form submission?? how can i get rid off event.preventDefault() ??
@dcode-software
@dcode-software 4 жыл бұрын
If you want to do a traditional form submission then you don't need to worry about preventDefault
@leslinks
@leslinks 4 жыл бұрын
​@@dcode-software Thank You for the response. yeah right but, i've used preventDefault() to stop the form and did the form validation. now the validation is working nicely but the form is not submitting because of preventDefault(). i prefer JS validation instead of php validation. how do i continue to submit the form after the validation. i use php and mysql.
@iloveafrica8980
@iloveafrica8980 3 жыл бұрын
What is google waiting for?
@creativeuk6882
@creativeuk6882 6 жыл бұрын
Great video. Can you make video on PHP. I am learning something new in all of your videos even though I am an intermediate developer.
@dcode-software
@dcode-software 6 жыл бұрын
That's great to hear 😁 I have a new series lined up which I'll be releasing soon. After that though I'm definitely down to do some PHP because it is one of the first languages I learnt! Cheers for your support
@shahulya7654
@shahulya7654 3 жыл бұрын
Thanks so much❤️
@Rayberk
@Rayberk 4 жыл бұрын
it doesnt workd can u give the code?
@swapnilmane1599
@swapnilmane1599 3 жыл бұрын
Can u plz tell me which theme and font are you using...I love the theme and the font style...
@dcode-software
@dcode-software 3 жыл бұрын
Sorry but it's been a while since I've had this theme - I suggest trying GitHub Light though As for the font, it looks to be Office Code Pro D
@swapnilmane1599
@swapnilmane1599 3 жыл бұрын
@@dcode-software thank you...😊😊
@dharunsivakumar7584
@dharunsivakumar7584 3 жыл бұрын
Can't we do this without login.php?? @dcode Help me out.
@dcode-software
@dcode-software 3 жыл бұрын
Yes, you can do this with any server-side language or technology. This video is focused on the front-end
@forethiocodingstaff
@forethiocodingstaff 4 жыл бұрын
Please make video how to hide or encrypt JavaScript file
@lunacollacchi8798
@lunacollacchi8798 3 жыл бұрын
wasn't this supposed to be the vanilla javascript one?
@dcode-software
@dcode-software 3 жыл бұрын
This is using vanilla JavaScript
@mongocrazyy3854
@mongocrazyy3854 3 жыл бұрын
why not just add the code
@wealthwhiz270
@wealthwhiz270 3 жыл бұрын
Is This Possible Without Using PHP @dcode please reply ASAP
@dcode-software
@dcode-software 3 жыл бұрын
Yep - this is purely client side. It doesn't matter what the server-side language is
@ConsulthinkProgrammer
@ConsulthinkProgrammer 3 жыл бұрын
Yes, use apps script
@wealthwhiz270
@wealthwhiz270 3 жыл бұрын
@@ConsulthinkProgrammer Thanks
@ConsulthinkProgrammer
@ConsulthinkProgrammer 3 жыл бұрын
@@wealthwhiz270 You're welcome. For more reference about HTML Form to Google Sheets use Apps Script kzbin.info/www/bejne/d3izd6asgN-Lo5I
@johnwick4144
@johnwick4144 4 жыл бұрын
did anyone get Status Code 405 Method Not Allowed on the line ==> request.send(new FormData(myForm));
@dcode-software
@dcode-software 4 жыл бұрын
If you are using a server built into your text editor or some other command line tool I recommend you download an actual server instead such as NGINX or Apache/XAMPP
@adolfjamesurian6510
@adolfjamesurian6510 4 жыл бұрын
Is this includes php language?
@dcode-software
@dcode-software 4 жыл бұрын
What do you mean?
@adolfjamesurian6510
@adolfjamesurian6510 4 жыл бұрын
There is login.php
@dcode-software
@dcode-software 4 жыл бұрын
Yes, this should work with PHP
@adolfjamesurian6510
@adolfjamesurian6510 4 жыл бұрын
So when i login it wont forget the exact value of when i did on sign up
@thestimup
@thestimup 4 жыл бұрын
Only getting this. Cannot POST /login.php 30 lines of code = 3 hours of troubleshooting @ developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest and developer.mozilla.org/en-US/docs/Web/API/FormData and developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send and developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open
@Saidur07
@Saidur07 3 жыл бұрын
Who uses light mode 🤣?
@dcode-software
@dcode-software 3 жыл бұрын
Me. Sometimes
@Saidur07
@Saidur07 3 жыл бұрын
@@dcode-software 😅😅
The BEST way to do form validation in JavaScript
59:45
Code With Bubb
Рет қаралды 19 М.
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,2 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 10 МЛН
Learn JavaScript Event Listeners In 18 Minutes
18:03
Web Dev Simplified
Рет қаралды 586 М.
Learn XML HTTP Requests in JavaScript | AJAX Tutorial
10:09
Form Validation Part II - JS and the Constraint Validation API
32:19
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 6 М.
How do you Submit an HTML Form?  How does it work?
17:02
Web Dev Cody
Рет қаралды 82 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
JavaScript Client-side Form Validation
29:07
Florin Pop
Рет қаралды 714 М.
Learn HTML Forms In 25 Minutes
24:56
Web Dev Simplified
Рет қаралды 972 М.
Event listeners in JavaScript - click, submit and change
8:21
Thomas W. Li-Smith
Рет қаралды 7 М.
React User Login and Authentication with Axios
31:37
Dave Gray
Рет қаралды 560 М.
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,2 МЛН