我正在尝试使用Apex inputText控件来使用jquery日期选择器从用户输入日期。
下面给出了页面代码和使用的javascript函数,当我使用HTML输入控件但不使用Apex inputText控件时,代码在我看来工作得非常好。
<apex:page showHeader="false" id="mypage" docType="html-5.0" controller="ControllerCalculateIncentive" sidebar="false" standardStylesheets="false">
<html>
<head>
<apex:stylesheet value="{!URLFOR($Resource.styles, 'bootstrap.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.styles, 'scrum.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.styles, 'jquery-ui.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.styles, 'font-awesome.css')}" />
<apex:includeScript value="{!URLFOR($Resource.styles, 'jquery-1.11.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.styles, 'bootstrap.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.styles, 'jquery.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.styles, 'jquery-ui.js')}"/>
<script type="text/javascript">
var j$ = jQuery.noConflict();
j$(document).ready(function(){
var v= '{!$Component.mypage:frm:StartDate}';
j$(v).datepicker({
dateFormat: 'dd-mm-yyyy',
changeMonth: true,
changeYear: true});
});
</script>
</head>
<body>
<apex:form id="frm">
<apex:inputText id="StartDate" value="{!StartDate}" ></apex:inputText>
<apex:form>
</body>
</html>
</apex:page>
答案 0 :(得分:1)
使用此行
solver = new LA2_MazeSolver(row, col)
这将使用jquery中的控件
答案 1 :(得分:0)
请尝试使用以下代码:
j$(document).ready(function(){
var v= '#StartDate'; //putting id of the input field directly
j$(v).datepicker({
dateFormat: 'dd-mm-yyyy',
changeMonth: true,
changeYear: true});
});