Issue in calendar display
I have a java file which contains the following code as a part of it:
onClickStartDate.append(" onclick=\"javascript:calendarSetUp(");
onClickStartDate.append("this");
onClickStartDate.append(",");
onClickStartDate.append("'"+inputFieldName+"'");
onClickStartDate.append(",'true'");
onClickStartDate.append(")\"");
if((attribute.equalsIgnoreCase("Planned start date")))
{
System.out.println("$$$$DATES");
retval.append("<input type=\"text\" tabindex=\"");
retval.append(rowNumber);
retval.append("\" name=\"r");
retval.append(rowNumber);
retval.append("c");
retval.append(colNo);
retval.append("\"");
retval.append(" value=\"");
retval.append(value);
retval.append("\"");
retval.append(onChange.toString());
retval.append(">");
retval.append("<img src=\"cim/images/calendar.gif\" id=\"calendarGif1\" alt=\"Add date\" " +onClickStartDate.toString()+"/>");
rowNumber++;
System.out.println("Retval STARTDATE : "+retval);
return(retval.toString());
}
I am getting the calendar image.
On click of that imabe on the first row,the particular function calendarSetup() is being called and I am getting the alerts in that function.
Then again when i click that calendar image of 1st row ,I am getting the calendar.
But if i do the same for other rows,it is entering into that celendarSetup method,getting the alerts.
Again if i click the calendar,i am not getting the calendar.
then i go to the image in the 1st row,then the calebdar is displayed and the date value is saved in the other row.
the calendar program used by me is:
<script language="JavaScript" src="<%=request.getContextPath()%>/esm/js/util.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/esm/js/calendar.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/esm/js/calendar-en.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/esm/js/calendar-setup.js"></script>
<script language="JavaScript">
function calendarSetUp(object,inputelement,calendarButton)
{
alert("Yo dude!! welcome");
alert(inputelement);
alert(calendarButton);
var calendar="";
if(calendarButton == "true")
calendar = "calendarGif1";
else
calendar = "calendarGif2";
Calendar.setup({
inputField :inputelement,// name of the input field
ifFormat : "%d-%m-%Y", // format of the input field
button : calendar, // trigger for the calendar align : "top", // alignment (defaults to "Bl")
valign : "right",
singleClick : true,
mondayFirst : true
});
}
</script>
Could anyone resolve this issue for me.plsssssss