Spring, Form tag based Datepicker in Jquery? -
actually in spring application i'm using spring based form
tag in jsp code.
and add functionality <form:input>
,provide datepicker using jquery.
and hear jsp code..
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <link rel="stylesheet" href="resources/css/jquery-ui.css" type="text/css"> <link rel="stylesheet" href="resources/css/custom.css" type="text/css"> <script type="text/javascript" src="resources/jquery/jquery-ui.min.js"></script> <form:form action="form/form1" modelattribute="form1"> <label class="control_label_c">from : </label> <div class="controls_c"> <form:input type="text" path="fromdate" class="date-picker" /> </div> </form:form> <script> $(function() { $('.date-picker').datepicker( { changemonth: true, changeyear: true, showbuttonpanel: true, dateformat: 'mm yy', onclose: function(datetext, inst) { var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); $(this).datepicker('setdate', new date(year, month, 1)); } }); }); </script>
but date picker not working (not visible)...
is problem spring based form tag? or
is wrong code?
it's because reference issues. please check following, preferably using firebug or developer tools in browser
- jquery ui compatible version of jquery referenced
- jquery ui css referenced properly
- jquery ui js referenced
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
Comments
Post a Comment