calculating age based on user DOB entry

Status
Not open for further replies.

kcionline

New Member
Tried using java but it won't process event basic date handling. Is there a way to do this in java? if not, how could it be done using eval?

we're doing age restrictive events and want to validate at sign-up.

any help would be greatly appreciated.

many thanks
 
You should be able to calculate an age from a DoB in JavaScript. What was the problem when you tried that.

If it really won't work, yes, you could eaisly do it with a forum submit script. What format do you want the age in? A MySQL date format, or timestamp?

-- hugh
 
Wow that's quick!!

I'm glad you've suggested a submit script as although I managed to get some java to work using the date object, after all the effort for some unknown reason, java actions have completely stopped working on my forms in both IE7 and firefox 2.0.0.12!?. I' reduced the java on various controls I've tried to : alert('anything'); with an onclick action on the element and still nothing. The form ID is 17 so my java is 17.js and is in the correct place. as I say right up to 1 hour ago it all worked. Interestingly, it has consistently refused to work in IE7, then when I switched back to firefox, it worked for a while then stopped dead without warning.

I think a submit script is safer. If you can help with the submit script, all I need is 1. an age calculated from
dob and 2. age on a forward date calculated from dob.

Is that possible?

thanks
 
Do you use FireBug? If so, is it showing any script errors?

If you don't run FireBug ... you should do ... Tools, Add Ons, Get Extensions ...

If we can't get your JS working, we'll try it with PHP.

Is the test page reachable by me?

-- hugh
 
Thanks for the help, it's great.

As I didn't sem to be getting very far I moved on to something else but in doing so discovered something very strange. When I opened the detail view of a table, it came up in firefox AND IE in the bluesky the template and guess what? the java started working!

I've been using siteground7 from siteground hosting. I don't have to use it mind you but I'm puzzled as to what could suddenly break java?!

Mind you there are several css complaints in the firefox error console. Maybe I'll re-apply the site template?
might have gotten corrupted maybe.

I'll try your firebug suggestion but as the project it for internal use I think anything that just works well and is readable will be just fine for us.

many thanks for all you do.
 
If you do any JS work, FireBug is invaluable.

Here's an example snippet for calulating age from DoB in JavaScript, which includes an "as of" option, so you can calcualte the age as of some future date.

http://snippets.dzone.com/posts/show/623

That just happened to be the first one I found, I'm sure there's dozens of others ... google is your friend ...

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top