0

Here i am using a jquery datepicker from this sample http://dev.jtsage.com/jQM-DateBox2. It is working fine but the problem is after clicking the submit button if there is any mandatory field validation error,the next time when i click the textbox jquery datepicker is not working means the script is not loading after submit click.it is throwing the error in firebug console like

TypeError: $(...).datebox is not a function
$('#txtstartdate').datebox('open');

Here is my code

$(document).ready(function () {
    $('#txtstartdate').live('click', function () {
        $('#txtstartdate').datebox('open');
        $("#txtstartdate").datebox("option", {
            mode: "calbox",
            highDatesAlt: ["2011-11-09", "2011-11-10"],
            highDates: ["2011-11-02", "2011-11-03"],
            pickPageOAHighButtonTheme: "b"
        });
    });
 });

and

@Html.TextBoxFor(m => m.StartDate, new { @name = "mydate", @id = "txtstartdate",  style = "height:20px; font-size:10px;", data_role = "datebox", data_options = "{\"mode\":\"calbox\",\"useButton\": false}" })

Any suggestion?

1 Answer 1

1

as the firebug error suggest the browser could not find the function being used within the script can you make sure that the dependencies of the datebox is availiable after the submit call.
also try to send the dependencies with the view itself so that on every rendering of the view page at the client end it hold these js file with in it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.