开发者

jquery UI DatePicker IE - Validators Interfering

ASP.Net 3.5 Application.

Date picker shows and when i try to click the date, IE 8 (I havent checked other versions) throws "length is null or not an object" error. It puts the date in the text box but then throws error. When i click out side the date picker area, it hides properly without any error. FF behaves properly.

Error is on the following line in generated webresource_3.axd file (line # 175). When i take out all 3 validators then it works normal.

var i;
for (i = 0; i < vals.length; i++) {
    ValidatorValidate(vals[i], null, event);
}

Page code:

Head References

<scriptsrc="Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<linkhref="Scripts/jquery.ui/jquery-ui-1.8.7.custom.css" rel="stylesheet" type="开发者_运维百科text/css" />

<scriptsrc="Scripts/jquery.ui/jquery-ui-1.8.7.custom.js" type="text/javascript"></script>

Page HTML

<tableid="tbl_control" cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td align="center">
            <input name="ctl00$ContentPlaceHolder1$dtStartDate$txtDate" type="text" value="08/05/2011" size="12" id="ctl00_ContentPlaceHolder1_dtStartDate_txtDate" class="StandardText" />
        </td>
        <td align="center">
            <span id="ctl00_ContentPlaceHolder1_dtStartDate_RegularExpressionValidator1" class="StandardText" style="color:Red;display:none;">Enter valid Date</span>
            <span id="ctl00_ContentPlaceHolder1_dtStartDate_CompareValidator1" class="StandardText" style="color:Red;display:none;">*</span>
            <span id="ctl00_ContentPlaceHolder1_dtStartDate_RequiredFieldValidator1" class="StandardText" style="color:Red;display:none;">Date should not be blank</span>
        </td>
    </tr>
</table>

javascript: ClientID and ResolveUrl utilized to get text box id and image path.

<scripttype="text/javascript"> 
    $(document).ready(function() {
        $(".ui-datepicker-trigger").show();
        $('#ctl00_ContentPlaceHolder1_dtStartDate_txtDate').datepicker({showOn: 'button',
            buttonImage: '/Source/images/SmallCalendar.gif',
            buttonImageOnly: true});
    });
</script>

I have also implemented the following and it is resulting in the same problem: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/

If the day clicked and showing in the text box are the same then i don't have this problem.

Thanks


Comment 4 on this jQuery UI bug ticket points out 4 possible solutions to this problem. They said that the first: "add an empty onSelect event to the datepicker" worked for them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜