...

View Full Version : Urgent: Trying to disable a popup calendar works in IE not in Netscape.



JMech
10-20-2005, 08:39 PM
I am trying to get a pop up calendar to be disabled when a certain criteria is selected using a drop down box. Every thing is working in IE but Netscape is giving an event is not defined message when the calendar image is clicked on. here is the javascript being used.

function showHideCalendarObject(dateField,fromToDateField,fromTo){
var selectedValue = document.forms[1].elements[dateField].value;
var fromToField = 'searchDefinitionForm.'+fromToDateField;
if (selectedValue == 'E' || selectedValue == 'G' || selectedValue == 'L'){
if (fromTo == 'from'){
g_Calendar.show(event,fromToField,true,'mm/dd/yyyy'); return false;
}
if (fromTo == 'to'){
g_Calendar.hide(event,fromToField,true,'mm/dd/yyyy'); return false;
}
}
if (selectedValue == 'B' || selectedValue == null || selectedValue.charAt(0) == ''){
g_Calendar.show(event,fromToField,true,'mm/dd/yyyy'); return false;
}
if (selectedValue == 'N'){
g_Calendar.hide(event,fromToField,true,'mm/dd/yyyy'); return false;
}
}



<tr bgcolor="#d8e0ea">
<td COLSPAN="0" ALIGN="CENTER" VALIGN="MIDDLE" width="25"
class="asterisk"><mcihtml:errors property="orderCreateDate"/></td>
<td ALIGN="CENTER" VALIGN="MIDDLE" class="asterisk" width="<%=f%>"><mcibean:message
key='orderCreateDate.requiredPrefix' view='<%=view%>' /></td>
<td width="<%=g%>"><a class="labelentry"
title="<mcibean:message key='orderCreateDate.help' view='<%=view%>'/>">
<mcibean:message key='orderCreateDate.label' view='<%=view%>' /></a></td>
<td class="fieldentry" colspan="3" width="<%=g%>"><html:select name="searchDefinitionForm"
property="orderCreateDate" onchange="javascript:disableDateField('orderCreateDate','orderCreateDateFrom','orderCreateDateTo');">
<html:optionsCollection property="displayDateFilters"
label="label" value="value" />
</html:select></td>
<td COLSPAN="0" ALIGN="CENTER" VALIGN="MIDDLE" width="25"
class="asterisk"><mcihtml:errors property="orderCreateDateFrom"/></td>
<td colspan="3" class="fieldentry"><html:text
name="searchDefinitionForm" property="orderCreateDateFrom"
maxlength="15" size="15" /> <a href="javascript: void(0);"
onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;"
onmouseout="if (timeoutDelay) calendarTimeout();window.status='';"
onclick = "javascript:showHideCalendarObject('orderCreateDate','orderCreateDateFrom','from');">
<%-- onclick="g_Calendar.show(event,'searchDefinitionForm.orderCreateDateFrom',true,'mm/dd/yyyy'); return false;"> --%>
<os:image file="calendar.gif" name="imgCalendar" alt="calendar"
border="0" /></a>
</td>
<td COLSPAN="0" ALIGN="CENTER" VALIGN="MIDDLE" width="25"
class="asterisk"><mcihtml:errors property="orderCreateDateTo"/></td>
<td class="fieldentry" colspan="3"><html:text name="searchDefinitionForm"
property="orderCreateDateTo" maxlength="15" size="15" /> <a
href="javascript: void(0);"
onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;"
onmouseout="if (timeoutDelay) calendarTimeout();window.status='';"
onclick = "javascript:showHideCalendarObject('orderCreateDate', 'orderCreateDateTo','to');">
<%-- onclick="g_Calendar.show(event,'searchDefinitionForm.orderCreateDateTo',true, 'mm/dd/yyyy'); return false"> --%>
<os:image file="calendar.gif" name="imgCalendar" alt="calendar"
border="0" /></a></td>
</tr>

Any ideas would be appreciated. Thank you.

Lerura
10-20-2005, 08:53 PM
the script must then be:

function showHideCalendarObject(dateField,fromToDateField,fromTo){
if (document.all){
var selectedValue = document.forms[1].elements[dateField].value;
var fromToField = 'searchDefinitionForm.'+fromToDateField;
if (selectedValue == 'E' || selectedValue == 'G' || selectedValue == 'L'){
if (fromTo == 'from'){
g_Calendar.show(event,fromToField,true,'mm/dd/yyyy'); return false;
}
if (fromTo == 'to'){
g_Calendar.hide(event,fromToField,true,'mm/dd/yyyy'); return false;
}
}
if (selectedValue == 'B' || selectedValue == null || selectedValue.charAt(0) == ''){
g_Calendar.show(event,fromToField,true,'mm/dd/yyyy'); return false;
}
if (selectedValue == 'N'){
g_Calendar.hide(event,fromToField,true,'mm/dd/yyyy'); return false;
}
}
}

JMech
10-20-2005, 08:59 PM
Well that got rid of the JS message that Netscape was trowing but the calendar still doesn't pop up at all when it is supposed to:(. I guess I should add that the g_Calendar code in the JS is the same as what was commented out in the HTML. When the onclick for the calendar was the g_Calendar it worked fine in Netscape but when it was moved into the JS it stopped working.

Lerura
10-20-2005, 09:37 PM
do you have a link to both the old and the new version

JMech
10-20-2005, 11:47 PM
Unfortunitely the site is within a fire wall adn can not be reached via internet. However the calendar code can be downloaded from www.totallysmartit.com/examples/calendar/simple.asp. It is pretty easy to just recreate what I have done by moving the onclick into a JS function.

JMech
10-21-2005, 02:55 PM
For those who may be interested I have figured it out. I had to move the conditions into the onclick instead of calling a function. Now Netscape is working the way it should.


onclick="if (orderCreateDate.value == 'E' || orderCreateDate.value == 'G' || orderCreateDate.value == 'L' || orderCreateDate.value == 'N'){g_Calendar.hide(event,'searchDefinitionForm.orderCreateDateTo',true, 'mm/dd/yyyy'); return false;} else{g_Calendar.show(event,'searchDefinitionForm.orderCreateDateTo',true, 'mm/dd/yyyy'); return false;}"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum