A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [RESOLVED] Age Validation

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    20

    resolved [RESOLVED] Age Validation

    Hello,

    I was wondering if someone could help me with some age validation. Basically you have to be 18 or over to enter a part of the site. I would like the user to pick their birthdate from 3 drop down boxes, then have that validate against whether they are over 18 or not and then when they click the submit button if they are over 18 then it takes them to a new page. If not an error is displayed either by popup or by text stating that you must be over 18 to enter.

    I know it sounds pretty straight forward but i am struggling with it as i am relatively new to developing with Actionscript.

    Thanks for reading and for any help in advance for this!! :-)

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    Age verification is a redundant thing, if someone wants to see that part of the site, they will lie, nothing you can do about that.

    It might be a legal requirement though. If it is, I suggest you save yourself the trouble and have two buttons "Enter" and "Exit" and some text saying that you must be 18+ to enter.
    New sig soon

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    20
    Hey, thanks for the response!

    Yeah i thought that, and i realise that that's the way its done these days however the client i am making this site for has specifically requested this feature so i kinda have to implement it. Just a basic one like this: http://www.rockstargames.com/IV/

    Thanks.

  4. #4
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    It IS a legal requirement, and depending on the content and the, for the lack of a better word, legal-ness of the site, the complexity differs. If there is more chance of a lawsuit, there needs to be more security. For example, if it's for a site that receives 10 hits per day, a simple enter/exit will suffice. If it's for a movie promo website with some "red band" trailers, they typically require REAL age verification. Where a few more snippets of information are captured and are actually verified with a database of citizens. Crazy, but it's real. In this case, do what the client wants, because if it comes down to it, he may be advised to do such by his/her lawyer, and if you talk him out of it and he's sued, he may turn to you for giving him wrong legal advice.

  5. #5
    Junior Member
    Join Date
    Jul 2009
    Posts
    20
    Yes, i got in touch with my client and explained and they would rather the user either pick from a drop down menu or enter a birthdate themselves and then have that date validated. They like this way and would prefer it as its like a digital/online way of signing on a dotted line.

    This is just where i get a bit stuck as i have only recently started developing and am new to the form/drop down boxes and then the validation itself. in fact the only bit i know how to do is the if statement which would come at the end of the validation :-)

    Thanks for the responses so far though.......

  6. #6
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    In your case, just use the built in ComboBox components. They're real simple to use. Not the best looking, but drop in and add a couple lines of code.

  7. #7
    Junior Member
    Join Date
    Jul 2009
    Posts
    20
    Ok kool, yeah that seems simple enough, then i just need to find some code to pull the dates from the ComboBox's, validate it (check it against the current date) and then follow it up with an "if" statement?

  8. #8
    flash absorption vessel
    Join Date
    Jul 2009
    Posts
    31
    Here's a very basic example:

    Code:
    import fl.controls.ComboBox;
    
    var cb:ComboBox=new ComboBox();
    addChild(cb);
    
    for (var i:int=0;i<100;i++){
    	cb.addItem({label:i});
    }
    
    cb.addEventListener(Event.CHANGE,checkit);
    
    function checkit(e:Event){
    	var age=cb.selectedItem.label;
    	trace(age>18);
    }
    Though you should hack their webcam and run facial recognition to be sure.

  9. #9
    Junior Member
    Join Date
    Jul 2009
    Posts
    20
    Kool, that's great!! That is pretty much just what i needed to get me started :-) Thank you!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center