Dialog and datepicker questions

Dialog and datepicker questions

I created a dialog which has 3 text fields. I added a datepicker to one of them. On submit I'm trying to post the data in the fields to a web service.

The first time you fire up the dialog, I'm running into two problems. One, the values I'm getting from the fields are all emtpy. Two, the datepicker doesn't actually populate the field it's attached to. The 2nd time, they all work fine. Any ideas?

Thanks!

This is part of the $(document).ready handler:

$("#expDate").datepicker();

            $(".ui-datepicker").css({ 'z-index': 1003});
            
            $("#saveToListDialog").dialog({
                autoOpen: false,
                model: true,
                position: 'center',
                title: 'Create List',
                zIndex: -1,
                buttons: {
                    "Cancel": function(){
                        $(this).dialog("close")
                    },
                    "Save": function(){
                        blackbird.debug("name: " + $("#listName").val());
                        $.post('/list/saveList',
                        {
                            name: $("#listName").val(),
                            comment: $("#listComments").val(),
                            expireDate: $("#expDate").val()
                        },
                        function(){
                            loadWidget("allLists", "results");
                        });
                        $(this).dialog("close");
                    }                    
                }
            });


And this is the html I'm using for the dialog:

<div id="saveToListDialog">
    <div>
        List Name: <input type="text" id="listName"/>
    </div>
    <div>
        Comments: <textarea id="listComments"/>
    </div>
    <div>
        Expiration Date: <input type="text" id="expDate"/>
    </div>
</div>