I have this code to allow users to enter dates into a RadDateInput using the formats mdyy or mddyy, reformatting them as mm/dd/yyyy. It works great for Firefox and IE8, but it does not work for IE7. I walked through the code, and set_newValue is in fact fired, but it does not change the date, and it handles those formats as invalid.
I also tried hacking it by setting the textbox and hidden fields directly, but that failed in pretty short order.
Has anyone implemented set_newValue in IE7?
Thank you,
Eric
I also tried hacking it by setting the textbox and hidden fields directly, but that failed in pretty short order.
Has anyone implemented set_newValue in IE7?
<script type="text/javascript"> function PreParseDate(sender, eventArgs) { var reSpace = /\s*/g; var reMdyy = /^\d{4}$/; var reMddyy = /^\d{5}$/; var val = eventArgs.get_newValue().replace(reSpace, ''); if (reMdyy.test(val)) { eventArgs.set_newValue('0' + val[0] + '/0' + val[1] + '/' + (val[2] > 1 ? '19' : '20') + val[2] + val[3]); } else if (reMddyy.test(val)) { eventArgs.set_newValue('0' + val[0] + '/' + val[1] + val[2] + '/' + (val[3] > 1 ? '19' : '20') + val[3] + val[4]); } }</script><telerik:RadDateInput ID="rdiDOB" runat="server"> <ClientEvents OnValueChanging="PreParseDate" /></telerik:RadDateInput>Thank you,
Eric