Jun 19th, 2010, 12:41 PM
Hi Mun,
Neat! Sure, you could do this using the Submission Pre-Parser module.
That module lets you execute your own custom code on the submission data right before it gets added to the database, and right before it's updated.
In your case, you could use it to examine the contents of the DOB field, calculate the age, then store the age in a new field in the database (you could just create it in the Edit Form -> Database tab - you wouldn't need to actually add it to your original form).
The actual code would depend on the format that the DOB field has. Note: that field has to be consistently entered. If it's just a text input field in your form, this won't work: the code would require a format like YYYY/MM/DD or something like that.
Maybe give the Submission Pre-Parser module documentation a look over to get an idea of how it works, then post me back if you need a hand with the PHP.
http://modules.formtools.org/submission_pre_parser/
- Ben
Neat! Sure, you could do this using the Submission Pre-Parser module.
That module lets you execute your own custom code on the submission data right before it gets added to the database, and right before it's updated.
In your case, you could use it to examine the contents of the DOB field, calculate the age, then store the age in a new field in the database (you could just create it in the Edit Form -> Database tab - you wouldn't need to actually add it to your original form).
The actual code would depend on the format that the DOB field has. Note: that field has to be consistently entered. If it's just a text input field in your form, this won't work: the code would require a format like YYYY/MM/DD or something like that.
Maybe give the Submission Pre-Parser module documentation a look over to get an idea of how it works, then post me back if you need a hand with the PHP.
http://modules.formtools.org/submission_pre_parser/
- Ben