Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.
    Code:
    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;
    }
    }
    Code:
    <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.
    Last edited by JMech; 10-20-2005 at 07:44 PM.

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    899
    Thanks
    0
    Thanked 118 Times in 117 Posts
    the script must then be:
    Code:
    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;
    }
    }
    }

  • #3
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by JMech; 10-20-2005 at 08:04 PM.

  • #4
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    899
    Thanks
    0
    Thanked 118 Times in 117 Posts
    do you have a link to both the old and the new version

  • #5
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unfortunitely the site is within a fire wall adn can not be reached via internet. However the calendar code can be downloaded from http://www.totallysmartit.com/exampl...dar/simple.asp. It is pretty easy to just recreate what I have done by moving the onclick into a JS function.

  • #6
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    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;}"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •