Click to See Complete Forum and Search --> : "tick here to accept terms and conditions"...


hammerslane
09-03-2003, 07:55 AM
hi, in javascript can anyone help me form that when you click submit, checks that the 'accept' tick box is checked, and then proceeds, and if it's not ticked, displays an alert "accept the terms and conditions or die" (wtte).

thanks :)

Khalid Ali
09-03-2003, 10:55 AM
you need to do few things like this in your form

add this in the form element

<form id="form1" action="" onsubmit="return validate(this);">
<input type="checkbox" name="tick_box">
then add the onclick button as below

<input type="submit" value="Submit">

</form>

now in the head section add the following javascript code

<script type="text/javascript">
function validate(frm){
if(frm.tick_box.checked){
return true;
}else{
alert("Please Tick the checkbox..:-)");
return false;
}
}
</script>

AdamBrill
09-03-2003, 12:15 PM
However, you should really do a check server-side, since a check like this would be easy to fake...

Khalid Ali
09-03-2003, 12:24 PM
Originally posted by AdamBrill
since a check like this would be easy to fake...

I am sorry Adam,I think I did not understand,can you please elaborate

AdamBrill
09-03-2003, 12:41 PM
I was just stating that it wouldn't be extremely difficult to submit the form without checking the box. There are a number of ways it could be done, the easiest of which would probably be turning off JS... ;) Or just take out the onsubmit with a simple addressbar JS script. :D

Khalid Ali
09-03-2003, 12:44 PM
:)
K got it...( did u say I needed more coffee)

AdamBrill
09-03-2003, 12:50 PM
Originally posted by Khalid Ali
:)
K got it...( did u say I needed more coffee) LOL... Speaking of coffee, that sounds pretty good to me, too. ;)

Khalid Ali
09-03-2003, 12:55 PM
okkk thats it..me heading out to starbucks....
Oh BTW is ryan up..or he is still asleep(giggles)

Edit

Just saw him..obviously he is up..:-)

Macman
09-03-2003, 04:16 PM
I am currently wprking on a sript with another member that may be what you want to use. Still need to insert the script that will check to see if the surfer has js and cookies enabled . If they do not they are redirected away from the site. I already have a working script which checks age and if not an adult will block them and send them away without being able to use their backbutton to try again. This uses cookies and is set to last 6 months. I am on a different machine at the moment and will post a note with the script I have now when I finish what I am doing on the other one.:)

AdamBrill
09-03-2003, 04:46 PM
There are many other ways to fake it besides turning off JS. Also, you shouldn't base anything off of cookies, since they can be turned off or deleted... not to mention that if I type in my age wrong I get kicked off of your site for 6 months. If that should happen, I'm pretty sure I wouldn't even bother going back...

I would highly suggest that you just do it server-side.

Macman
09-03-2003, 07:15 PM
Well I thought of using SSI but I am more interest in making sure the surfer has JS and cookies enabled. My sites (30) use lots of JS in the pages and if that is not enabled than the site can not be view properly. I have added a warning on the index page to that effect. In addition for legal & moral reasons I can not permit underage (under 18) onto my site. The cookie can be deleted by anyone smart enough and also old enough if they entered the wrong birthdate to come back and do so. I want it to be hard to enter for anyone looking for a cheap way and not willing or able to spend money and of age to enter. It has gotten to the point that webmasters such as myself have to pay for our bandwidth and not get anything in return except heartache because minors are getting into our sites. All they do is burn up our bandwidth and bring trouble. The otherside of the picture is that there all too many "johnny come lately" 20 year olds that are flooding the net with material not suitable for anyone under 18, because they think they can make a fortune and not blocking entrance by minors.:mad:

Sux0rZh@jc0rz
09-03-2003, 07:44 PM
use a freaking creditcard on the frontpage of the site/sites. and also you dont have to make it extremely hard to get in because if its a problem at all they will leave because they know they will find better with less work(the hun, 89, ect)

Macman
09-03-2003, 08:32 PM
Your point is well taken. As that is one of the problems here in the US. CC companies are making it harder to use them for that purpose. Have to go with making it harder and not having the legal problems that will haunt those that let minors in.

AdamBrill
09-03-2003, 09:08 PM
Originally posted by Macman
In addition for legal & moral reasons I can not permit underage (under 18) onto my site.Umm... right. :rolleyes: I have the perfect solution to your problem: CHANGE THE CONTENT OF YOUR SITE! Chances are, if there are "legal & moral" reasons that a minor shouldn't be on the site, then there are certainly "moral" reasons that you(or anyone else) should not be running it. For that matter, there probably isn't a reason for adults to be visiting that page either.

tim822002
09-03-2003, 10:32 PM
im trying to make the same type of script, only mine is for warez stuff

Macman
09-04-2003, 12:37 AM
Adam I think you missunderstood what my statement was about. It has become all to apparent that companies and certain groups believe that they know best for everyone else. For example ebay/PayPal believe it is such a BIG no no that they will longer handle any adult material even Playboy Mag. It has gotten so bad that you can't even buy a copy of Payboy in your local 7Eleven and in some statioary stores you have to ask the clerk for a copy, It is also important to remember not to long ago an over zealous DA in a midwestern state attacked the movie "Toy Story" on moral and legal grounds. It was laughed out of the higher courts but not until a lot of adults were hassled by this DA. Webmasters are faced with this kind of additude from many crack pot DA that think that they know and have to decide what other adults should be allowed to view. This seems to hark back to the days of the Witch trials. No one should attempt to force their viewpoints on any other individual as to what they can or can not view. But we can decide at what age you can view what ever you please.l I am 68 years old and have been constantly changing with the changes in our society, since I was an 8 yr old during WWll. My personal view is if your 18 or older you can view anything you wish to regardiess of anyone else';s opinion which by the way they are entitled to in this free country.

Macman
09-04-2003, 04:19 AM
Hope you can used the attached scripts. First is a splash page index.html w/redirect if user has JS and/or cookies enabled toa combination Age verification/form check box script ajust as you need.

Hope this helps:)

hammerslane
09-04-2003, 04:23 AM
thanks guys, who needs javasript books when you have this place :)

i sort of mixed and matched lil bits of info from all the posts, and i now have a lovely lil check box that works... and you HAVE TO CLICK IT, or you don't even see the page.

/so proud.

thanks again everyone
l8rz

AdamBrill
09-04-2003, 07:34 AM
Originally posted by Macman
My personal view is if your 18 or older you can view anything you wish to regardiess of anyone else';s opinion which by the way they are entitled to in this free country. Legally, yes, you can view whatever you want, but that doesn't make it right. And even worse than that would be if you actually host a site like that. This world is in such a sad state... :(

hammerslane, if you only use JavaScript code(no server-side), I guarentee that I wouldn't have to check the box to get into the page. If the page is acceptable, you can post a link and I will let you know how I got by without clicking the box...

hammerslane
09-04-2003, 07:37 AM
lol :D i'm sure if you REALLY wanted to get past the page without ticking the box you could always find a way. but the fact that it states "by clicking 'proceed', you hereby accept our terms and conditions. please confirm that you have read and accepted them by checking the box" or wtte.

fraid i cant link to the page, its a company site, under construction still and password protected, thanks again

edit: as the server is php enabled, can you sumarize how i would go about doing the tick box validated server side?

l8rz