The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Hi.
Right, basically I'm trying to write a swear checker function. The code is this:
The swear checker itself seems to work - it chucks up an alert if any of the words are found - but what it doesn't do is stop the form from doing it's action. So even if the alert comes up, the 'return false;' part of it never seems to get through and I really don't know why.
As well as that in the alert, if there's more than one word, there's always a comma before every word after the first and I cannot ascertain as to why.
Any ideas?
Cheers.
Right, basically I'm trying to write a swear checker function. The code is this:
The swear checker itself seems to work - it chucks up an alert if any of the words are found - but what it doesn't do is stop the form from doing it's action. So even if the alert comes up, the 'return false;' part of it never seems to get through and I really don't know why.
As well as that in the alert, if there's more than one word, there's always a comma before every word after the first and I cannot ascertain as to why.
Any ideas?
Cheers.
Page:
cjh wrote:
> Yeah, sure you were ;)
Heh :-) I find it easier to do (if){thenning} because it's more logical and easier to comprehend.
> No problem, does it work as you'd wanted it too?
It indeed does. I realised why storing the found words in an array produced commas though... Well, actually I didn't but I remembered about the .join() method and used it as alert(found_words.join('.\n')) Did the trick nicely :-)
thanks again :-D
> Yeah, sure you were ;)
Heh :-) I find it easier to do (if){thenning} because it's more logical and easier to comprehend.
> No problem, does it work as you'd wanted it too?
It indeed does. I realised why storing the found words in an array produced commas though... Well, actually I didn't but I remembered about the .join() method and used it as alert(found_words.join('.\n')) Did the trick nicely :-)
thanks again :-D
Yeah, sure you were ;)
No problem, does it work as you'd wanted it too?
No problem, does it work as you'd wanted it too?
Excellent, thanks.
I was thinking about doing it with for loops, but (if){thenning} was what I settled for. If I hadn't got it working through this, then for looping was my fallback plan.
Anyway.
Cheers :-)
I was thinking about doing it with for loops, but (if){thenning} was what I settled for. If I hadn't got it working through this, then for looping was my fallback plan.
Anyway.
Cheers :-)
ok, I've re-writen it for you, and it seems to do what you wanted.
==================================================
Swear Filter
==================================================
==================================================
==================================================
I got it working :)
Although, the pop-up window now likes to come up a load of times before it either submits or doesn't :(
Maybe you can see why, so here is the code I've got:
(I'll keep looking into it though)
----------------------------------------------
Swear Filter
Although, the pop-up window now likes to come up a load of times before it either submits or doesn't :(
Maybe you can see why, so here is the code I've got:
(I'll keep looking into it though)
----------------------------------------------
cjh wrote:
> with:
> found_words += swear_words[swear_words_length] + '.\n';
Excellent. That works. Thanks.
Re: the return problem, if I simply add "return false;" then yes, the form does not submit, so it IS a problem in the function. Exactly what that problem is I really don't know. Maybe it's because it has to cycle through the function more than once? I can't see why that would be the prob though because I've written a form validation script before which works on pretty much the same principle...
Hmmm.
> with:
> found_words += swear_words[swear_words_length] + '.\n';
Excellent. That works. Thanks.
Re: the return problem, if I simply add "return false;" then yes, the form does not submit, so it IS a problem in the function. Exactly what that problem is I really don't know. Maybe it's because it has to cycle through the function more than once? I can't see why that would be the prob though because I've written a form validation script before which works on pretty much the same principle...
Hmmm.
Still looking into it :)
Oh, and language="javascript" is deprecated, its just:
Oh, and language="javascript" is deprecated, its just:
It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.