![]() |
Javascript question
Trying to implement a contact form into a site but having some issues.
Original programmer used tables, which I removed and changed a few things. When I submit the form without entering anything, the errors come up, and every time the focus is changed on a field, the error pops up again and I end up with multiple errors coming up down the page. Is there a way to change the JS below to fit with my layout and so it doesn't repeat itself ten million times? http://i50.tinypic.com/2ugfgbn.jpg Code:
$(function() { Quote:
The HTML I'm using Code:
<div class="wrap" align="center"> Code:
<table> |
Maybe rename the thread to "javascript" as java is completely unrelated.
|
As uniqumkt said, this has as much to do with Java as automobile has with bile. The two words have some of the same letters, and are completely unrelated.
What you want to do is before the event loop add var i = 0; In the loop, add if ($i++} { continue; } That will print only one error message. I can't actually read your code on my phone, but the screenshot tells me what the code must be. |
Quote:
He is inserting the error message just before the parent object thus everytime he gets an error it is inserting a new line above the parent. At least that is the way I am reading it. But as usual we are not seeing all the code in play here, so I can't say for sure. As far as where the error message goes and your repeating messages, Myself, I would create a div in the html called error_div or something like that and on each error I would rewrite the div inner HTML. That way the error message always shows in the same spot and doesn't screw the layout and only one error message shows at a time. . |
Quote:
That just isn't right. Unless I am missing something here. .:helpme . |
Quote:
The EVENT loop. He's doing it in an event handler. Initialize to zero before outside the handler. BTW it's good to know the event loop IS a loop, one that's run a thousand times per second. Hook a garbage event or create a nested infinite loop and you'll get a nice crash - do not pass Go and do not collect an error message. |
Quote:
Most of my javascript is fairly simple stuff. Like I said, I didn't think I had the whole picture from just the code he showed. I knew the fucking messages were coming from somewhere ;p Thanx .. |
Quote:
|
All times are GMT -7. The time now is 03:52 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc