Click to See Complete Forum and Search --> : Image Disable !!
gnanesh
04-18-2003, 07:58 AM
Folks
I have developed an JSP application, in my front-end i have a drop down box(select - 2 options), based on the select option , i disable a table , which contains an text fields along with image icon(calender-this is an HREF) beside it, i am able to disable the text fields but still the user can able to click on the image(calender) which opens up the calender , Now i need to disable this calender(image) too, and i don't want to allow it to open incase the user clicks on it,
any inputs are welcome
regards
gnanesh
khalidali63
04-18-2003, 08:06 AM
Hunmm,
First thing that comes to mind is either remove the onclick event from the image or reset the value so that it would not call the function that calls the calendar because image does not have an attribute such as disabled or readonly( as far as I know).
gnanesh
04-18-2003, 08:20 AM
hi
thanks for the response, i don't have an onClick event, its an HREF , by the way how do i reset the value which doesn't call the function in my javascript
Let me know about this
regards
gnanesh
khalidali63
04-18-2003, 08:38 AM
You know what,you can do it this with allot simpler techniq.
set a variable to false or true in the code section where you disable the text field.
and when onclick is triggered before opening that calendar do an if statement
if(true){
open calendar
}
you don't need towrite anything otherwise.
:D
gnanesh
04-18-2003, 08:43 AM
hi
thanks again, i am confused here, by the way look into my javascript snippet and let me know what i should do
function validateStatus(){
var obj = document.InstallInformationDetailsForm.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_STATUS_TYPE_ID%>.value;
if(obj == "633"){
document.InstallInformationDetailsForm.contDates.disabled = false;
// how do i disable the image(href) ?
}
else{
document.InstallInformationDetailsForm.contDates.disabled = true;
}
}
thanks
Gnanesh
khalidali63
04-18-2003, 08:46 AM
post a link...to your page or upload the file zipped or as text.....if you hurry up..I can make it work ..otherwise wife is gonna take me for a grocery duties..
:D
gnanesh
04-18-2003, 10:56 AM
this is the snippet in my JSP page :-
<fieldset id="contDates"><legend><b>Delayed Contact Dates</b></legend>
<table width="98%">
<tr>
<TR ALIGN="left" VALIGN="middle">
<td>Delayed Contact Call 1:</td>
<td nowrap="true">
<input id="cDates" type="text" size="8" maxlength="8"
name="<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>" readonly="true"
value="<%=installationInfo.getStringValue(InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE)%>" id="dContCall1">
<a href="javascript:showCalendar(
'<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>',
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>.value,
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>);">
<img id="cImage" src="<webflow:createResourceURL resource="<%=calICN%>"/>" border="0"></a>
</input>
</td>
</TR>
</fieldset>
this is my javascript function:-
function validateStatus(){
var obj = document.InstallInformationDetailsForm.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_STATUS_TYPE_ID%>.value;
if(obj == "633"){
document.InstallInformationDetailsForm.contDates.disabled = false;
}
else{
document.InstallInformationDetailsForm.contDates.disabled = true;
}
}
khalidali63
04-18-2003, 11:08 AM
change these 2 parts
if(obj == "633"){
document.InstallInformationDetailsForm.contDates.disabled = false;
}
else{
document.InstallInformationDetailsForm.contDates.disabled = true;
}
as below
decalre a global variable at the beginning of your javascript code section
var displayCalendar = false;
if(obj == "633"){
document.InstallInformationDetailsForm.contDates.disabled = false;
displayCalendar = false;
}
else{
document.InstallInformationDetailsForm.contDates.disabled = true;
displayCalendar = false;
}
and then replace the code part where you call shoeCalendar...as below
<a href="javascript:if(!displayCalendar) return false;showCalendar(
'<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>',
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>.value,
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%> );">
<img id="cImage" src="<webflow:createResourceURL resource="<%=calICN%>"/>" border="0"></a>
</input>
I have not tested it,but it should work
gnanesh
04-18-2003, 12:52 PM
hi
thanks for the code, by the way when i click the image i am getting displayCalender is undefined !! please let me know where i have to define,
thanks
gnanesh
khalidali63
04-18-2003, 01:49 PM
ok..let get rid of inline code.
do this...in the link
<a href="javascript:Process()"><img...../>
and in the javascript section.
function Process(){
if(displayCalendar){
showCalendar(
'<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>',
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>.value,
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>' );
}
}
make sure that there are not any qoutes or brackets missing
:D
gnanesh
04-21-2003, 07:28 AM
hi
Thanks about the changes , this is what i made changes
<a href="javascript:Process()"> --- this is the Link
-- below is the script---
function Process(){
var displayCalendar = false;
if(displayCalendar){
showCalendar(
'<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>',
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>.value,
<%=thisForm%>.<%=InstallationInfoConstants.FLD_DELAYED_CONTACT_CALL_ONE_DATE%>);
}
}
But as i told you before that i have a drop down box which has two items "OPEN" & "CLOSE"
If the condition is OPEN i will allow them to click on the img(calender) to enter the date if its CLOSED i will disable the img field ,, After i changed this code when the condition is CLOSED i am unable to click the Image(which is fine ) but this is working for OPEN condition also, i need to enable the image icon on OPEN condition
Do i need to call the Process() function from my validateStatus() method too or how do i approach for this
Kindly let me know about this
Thanks
Gnanesh