Our QA posted this : Date
formatting: When ‘04162013’ is entered, the field will auto-format the
entry to reflect ‘04/16/2013’. If ‘0416/2013’ or ‘04/162013’ is
entered….the field flags the entry as an error and will not auto-format
Is there anything I can do using JavaScript and such ?
1 Answer, 1 is accepted
0
Angel Petrov
Telerik team
answered on 19 Apr 2013, 07:51 AM
Hi,
You can intercept the client-side OnValueChanging event and correct the value. An example of this is demonstrated below:
<telerik:RadDateInput runat="server">
<ClientEvents OnValueChanging="ValueChanging" />
</telerik:RadDateInput>
<script type="text/javascript">
function ValueChanging(sender, args)
{
var newValue = args.get_newValue();
if (newValue.indexOf("/") > -1)
{
var newValue = args.get_newValue();
var n = newValue.replace("/", "");
args.set_newValue(n);
}
}
</script>
All the best,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.