Date displayed as DateTime when Autofill

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
jleraj
User
Posts: 11

Date displayed as DateTime when Autofill

Post by jleraj »

Folks

I am using autofill to fill some fields based on selection of a particular drop down. One of the fields which are filled automatically is a date field, which is supposed to only DOB i.e.dd/mm/yyyy. But, during autofill the value that is retrieved is in dd/mm/yyyy hh:mm:ss, though in the backend ( SQL Server 2008 R2) the data is in dd/mm/yyyy format.

Can someone please explain why and how to overcome this ?

Thanks


motfs
User
Posts: 258

Post by motfs »

You can subscribe the "autofill" event to format the data, e.g:

$(document).on("autofill", function(e, args) {
//console.log(args); // Uncomment to view the arguments in browser console
if (args.target == "x<AutofillField>") { // Replace <AutofillField> with actual field name
args.data = args.data.replace("xxx", ""); // Replace 12:00:00 AM with empty string
$("#x
<AutofillField>").val(args.data);
}
});

If not sure, uncomment console.log(args) to view in browser console.


Post Reply