Cold Fusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingCold Fusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 22nd, 2008, 11:56 PM
susan_151615 susan_151615 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2008
Posts: 4 susan_151615 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 14 sec
Reputation Power: 0
Disabling a dropdown based on javascript

Hi I have a web page.Where i display a row of dropdown list s nearly 5 rows i display .When i choose any value from the main dropdown the other dropdown will get enabled but at the same time when i choose null value from the drop down,all the others will get disabled and they will also sho blank value.

Using array i wrote a javascript function to enable and disable it.It works quite fine

Now my problem is i have a feature"Add arow and delete a row"



When i add a row a row with the dropdown list will get added to already prsent dropdown and it should also do the same functionality(enabling and disabling) but its not working as required



The array way of adding and deleting a row which i did is:

function fnAddDelRows(valRowId){
if ((varNoofRows+valRowId>=5) && (varNoofRows+valRowId<=10)){
varNoofRows=varNoofRows+valRowId;
if (varNoofRows<10){
document.AdminChkReq.imgadd.style.cursor='hand';
}
if (varNoofRows>5){
document.AdminChkReq.imgdel.style.cursor='hand';
}
if (varNoofRows==5){
document.AdminChkReq.imgdel.style.cursor='';
}
if (varNoofRows==10){
document.AdminChkReq.imgadd.style.cursor='';
}
if(valRowId==1){
document.getElementById("row" + varNoofRows).style.display='block';
document.AdminChkReq.cmbDeptNo(varNoofRows-1).value='';
document.AdminChkReq.cmbAcctNo(varNoofRows-1).value='';
document.AdminChkReq.cmbSubAcct(varNoofRows-1).value='';
document.AdminChkReq.cmbProjNo(varNoofRows-1).value='';
document.AdminChkReq.cmbAcctCateg(varNoofRows-1).value='';
document.AdminChkReq.txtDistAmt(varNoofRows-1).value='';
}
if(valRowId==-1){
document.getElementById("row" + (varNoofRows + 1)).style.display='none';
}
fnCalcAmt();
}
}

the javascript which i wrote isfor anabling and disabling is)

<script language="javascript">
function fnenable(varIndex){
if(document.AdminChkReq.cmbDeptNo(varIndex).value != '')
{
document.AdminChkReq.cmbAcctNo(varIndex).disabled= false;
document.AdminChkReq.cmbSubAcct(varIndex).disabled =false;
document.AdminChkReq.cmbProjNo(varIndex).disabled= false;
document.AdminChkReq.cmbAcctCateg(varIndex).disabl ed=false;
document.AdminChkReq.txtDistAmt(varIndex).disabled =false;
}
else
{
document.AdminChkReq.cmbAcctNo(varIndex).disabled= true;
document.AdminChkReq.cmbSubAcct(varIndex).disabled =true;
document.AdminChkReq.cmbProjNo(varIndex).disabled= true;
document.AdminChkReq.cmbAcctCateg(varIndex).disabl ed=true;
document.AdminChkReq.txtDistAmt(varIndex).disabled =true;
document.AdminChkReq.cmbAcctNo(varIndex).value='';
document.AdminChkReq.cmbSubAcct(varIndex).value='' ;
document.AdminChkReq.cmbProjNo(varIndex).value='';
document.AdminChkReq.cmbAcctCateg(varIndex).value= '';
document.AdminChkReq.txtDistAmt(varIndex).value='' ;
}
}
</script>





Can anyone help me in sorting out this

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingCold Fusion Development > Disabling a dropdown based on javascript


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap