The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Date of Birth - Best way to collect from form - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Date of Birth - Best way to collect from form (/showthread.php?tid=1837)



Date of Birth - Best way to collect from form - alexh - Dec 28th, 2011

I want to have the user enter their date of birth in a form field on an external form. What is the best way to do this? If I leave a blank text field, people will enter it differently than others.. and if I do three separate fields (day, month, and year), I won't be able to put them together into one field in the database.

Any ideas??

Thanks!


RE: Date of Birth - Best way to collect from form - Ben - Dec 31st, 2011

Hi Alex,

I *KNOW*! This has been a recurring problem for us too. These days we rely on using a javascript calendar (jQuery UI has a nice one), which stores the info in a single field. That's probably your best approach - both for ensuring that 99% of users will submit the data in the same format, but also for usability's sake (they're very easy to use).

You can use 3 separate fields, but I agree: having them split up in the UI is pretty crumby. What I've done in the past is use the Submission Pre-Parser module to piece together the info to store it in a single field - not great, but passable.

Sorry to keep mentioning the upcoming Form Builder module in my posts (I'm just working on it all the time now), but it'll let automatically insert date, datetime and time fields into your published forms - just like with the FT interface. It'll be released soon. Really. (I'm knee deep in QA right now).

- Ben


RE: Date of Birth - Best way to collect from form - alexh - Dec 31st, 2011

Thanks Ben!

That totally makes sense. I suppose if I was able to piece the fields back together into one, I could do a drop down for month, day, and year... and that would solve the problem.

For now I used a java script to auto-add slashes... and then used java to require the format to require the four digit year.

Code:
<script type="text/javascript">
function addSlashes(input) {
    var v = input.value;
    if (v.match(/^\d{2}$/) !== null) {
        input.value = v + '/';
    } else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
        input.value = v + '/';
    }
}
</script>


Thanks for the ideas, and I look forward to the form builder module ;-)


-Alex

(Dec 31st, 2011, 11:26 AM)Ben Wrote: Hi Alex,

I *KNOW*! This has been a recurring problem for us too. These days we rely on using a javascript calendar (jQuery UI has a nice one), which stores the info in a single field. That's probably your best approach - both for ensuring that 99% of users will submit the data in the same format, but also for usability's sake (they're very easy to use).

You can use 3 separate fields, but I agree: having them split up in the UI is pretty crumby. What I've done in the past is use the Submission Pre-Parser module to piece together the info to store it in a single field - not great, but passable.

Sorry to keep mentioning the upcoming Form Builder module in my posts (I'm just working on it all the time now), but it'll let automatically insert date, datetime and time fields into your published forms - just like with the FT interface. It'll be released soon. Really. (I'm knee deep in QA right now).

- Ben