This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 4
Date of Birth - 3 column Drop Down as 1 entry?
Started 9 years ago by adrearubin | 3 posts |
-
Have a client who wants to set Date of Birth as separate drop downs (month, day, year) instead of a date picker. When i set this up and enter data, it appears in 3 separate entries. Is there a way to set it to appear as 1 entry?
Thank you.
Posted 9 years ago # -
No - since you are using three fields, which = three entries, as you have said. A special field like that would have to be built into the application (complicated if coding is not your forte).
You could still do this the way you have done, but in your confirmation email, sent to admin and/or client, set the field elements up, in such a way to make sense, rather than just listing them down the email message. You can set out the message in a manner that reads like a normal email, with form field place-holders being replaced by actual values, so in case of DOB, in the email would be set up like:
Date of Birth {element_1} {element_2}, {element_3}
And when the email is sent and opened, would read like : "Date of Birth: July 1, 1984"
Where element_1 is Month, element_2 is day, element_3 is year.
You can also set up the fields in the form to be on the same line, using the field alignment options so they would appear to be "one field". If there's two much spacing between them (even when aligned one line), then tweaking with CSS is possible, although not sure exactly how.
http://www.appnitro.com/doc-field-alignment. You could also use the user guidelines, and set them at the bottom, rather than as a pop-up at the side, and possibly also tweak the field names to smaller text (you would do this through CSS settings). You can also use HTML within any element's property option (such as the field label) so can use inline CSS to set the text to "small" or to a 'px' or 'em' font size.If you need quicker or specific assistance, suggest you email Appnitro directly
Posted 9 years ago # -
Thanks AMurray and to Andar, the javascript code was pretty simple. Once you know what the element key is for Month, Day, and Year input fields, you can easily put it in. Create your three drop downs, and your 1 hidden field.
This is what the javascript that Andar provided:
// JavaScript Document
$(document).ready(function() {
var dd = '';
var mm = '';
var yyyy = '';
$("#element_7").on('focus', function () {
dd = $("#element_7 option:selected").text();
}).change(function() {
dd = $("#element_7 option:selected").text();
$('#element_5').val(mm + '/' + dd + '/' + yyyy);});
$("#element_6").on('focus', function () {
mm = $("#element_6 option:selected").text();
}).change(function() {
mm = $("#element_6 option:selected").text();
$('#element_5').val(mm + '/' + dd + '/' + yyyy);});
$("#element_8").on('focus', function () {
yyyy = $("#element_8 option:selected").text();
}).change(function() {
yyyy = $("#element_8 option:selected").text();
$('#element_5').val(mm + '/' + dd + '/' + yyyy);});
});Then you reference that javascript in your form properties and viola, your hidden field is populated in mm/dd/yyyy format.
Thanks!
Question: Since I have the hidden field that will populate in MySQL, Is there a way to prevent the drop down from showing up in the DB since it's not really necessary? Just curious.
Thanks again.
Posted 9 years ago #
Reply
You must log in to post.