Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Bubbles68266y@growling I can if needed I was just ranting.
Update: I transferred the div code over to the one that works and it broke it somehow. So I have no idea what to do -
Bubbles68266y@growling
The Broken/copy of original:
https://pastebin.com/L2BsmJ8L
the simple fucking retarded working one:
https://pastebin.com/FN0uGVQa
idk how people usually share code aside github but I just use paste bin apologies for any future problems -
Bubbles68266yalso if its needed heres the php that works okay:
https://pastebin.com/aBNPxn6d
heres the javascript:
https://pastebin.com/PAp03JWa -
Bubbles68266y@growling it worked holy shit thank you. Can you explain why I need return I dont really understand
-
@Bubbles in your validator code, it returns true or false yes? If you return false onsubmit, you won’t be able to continue posting your form. However if it’s true, you continue. Therefore, when you had no return, the form didn’t really know what to do
-
Yeah your code will return undefined implitly since you are not returning anything. The return value is compared exactly (===) to false here, so undefined will not stop the form from submitting (the default behavior).
The more modern way to handle it would be to take the event as an input in your validator function and then call event.preventDefault() if the input is not valid.
Okay so I'm pissed. My JavaScript form validation doesnt work so I went tried it on the most simple fucking html form and it fucking works and I dont fuckign know what the problem is since I literally copy and pasted the form from the one that doesnt work
rant