留言板

Date pop up or calender not displayed

Hiten Shah,修改在9 年前。

Date pop up or calender not displayed

New Member 帖子: 16 加入日期: 14-5-21 最近的帖子
<script>
 function test(){	
	$(function(){
		$('.datepicker').datepicker({showAnim: "fadeIn"});
	}
	)
}
		 
		/*  AUI().use(
				  'aui-datepicker',
				  function(Y) {
				    new Y.DatePicker(
				      {
				        trigger: 'input'
				      }
				    );
				  }
				);
	  */
		 
			function showfield(name){
		if(name=='1')
		{
			//document.getElementById('div1').innerHTML='Round 1: <input type="date" name="txt" id="txt" class="input">';
			document.getElementById('div1').innerHTML='<p>Pick a Date: <input type="text" name="<portlet:namespace/>roundDate" id="datepicker" class="datepicker" onClick="test()"/></p>';
			//document.getElementById('div1').innerHTML='<p>Pick a Date:  <liferay-ui:input-date formName="date" yearRangeStart="1970"yearRangeEnd="2100" yearValue="2010" monthValue="3" dayValue="21"dayParam="d1" monthParam="m1" yearParam="y1" />';
		}
		else if(name=='2')
		{
			document.getElementById('div1').innerHTML='Round 1: <input type="text" name="<portlet:namespace/>roundDate" id="txt">';
			document.getElementById('div2').innerHTML='Round 2: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
		}
		else if(name=='3')
		{
			document.getElementById('div1').innerHTML='Round 1: <input type="text" name="<portlet:namespace/>roundDate" id="txt">';
			document.getElementById('div2').innerHTML='Round 2: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div3').innerHTML='Round 3: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
		}
		else if(name=='4')
		{
			document.getElementById('div1').innerHTML='Round 1: <input type="text" name="<portlet:namespace/>roundDate" id="txt">';
			document.getElementById('div2').innerHTML='Round 2: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div3').innerHTML='Round 3: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div4').innerHTML='Round 4: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
		}
		else if(name=='5')
		{
			document.getElementById('div1').innerHTML='Round 1: <input type="text" name="<portlet:namespace/>roundDate" id="txt">';
			document.getElementById('div2').innerHTML='Round 2: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div3').innerHTML='Round 3: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div4').innerHTML='Round 4: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
			document.getElementById('div5').innerHTML='Round 5: <input type="text" name="<portlet:namespace/>roundDate" id="txt1">';
		}

	  	else
		{	
			document.getElementById('div1').innerHTML='';
			document.getElementById('div2').innerHTML='';
			document.getElementById('div3').innerHTML='';
			document.getElementById('div4').innerHTML='';
			document.getElementById('div5').innerHTML='';
		}
	}
</script>

<aui:select name="totalRound" label="Total Round" onchange="showfield(this.options[this.selectedIndex].value)">
						<aui:option selected="true">Select Round</aui:option>
						<aui:option value="1">1</aui:option>
						<aui:option value="2">2</aui:option>
						<aui:option value="3">3</aui:option>
						<aui:option value="4">4</aui:option>
						<aui:option value="5">5</aui:option>
					</aui:select>
					<div id="div1"></div>
					<div id="div2"></div>
					<div id="div3"></div>
					<div id="div4"></div>
					<div id="div5"></div>

In this code when i will select the total number of round which is {1,2,3,4,5} after that number of textbox appear .
but not dispaly date pop up in that textboxes.

Example:
i will select total round 3 then it will display 3 textboxes named Round1 , Round2 ,Round3 and then i want a date from that texbox but there is not appear calender in that textboxes.
Hiten Shah,修改在9 年前。

RE: Date pop up or calender not displayed

New Member 帖子: 16 加入日期: 14-5-21 最近的帖子
Hello,
These many views but not a single answer of my question.

Thank you.
thumbnail
Mayur Patel,修改在9 年前。

RE: Date pop up or calender not displayed

Expert 帖子: 358 加入日期: 10-11-17 最近的帖子
Hi Hiten,

You need to specify class(.datepicker) in all text boxes,

$('.datepicker').datepicker({showAnim: "fadeIn"});

Thanks.