If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > jscript properties

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-22-04, 01:55
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
jscript properties

I am trying to hide a field when value in combo box lists changes.
I am trying to find what is the property to hide the field because originally I got help to put this code together but it doesn't quite do what I need, as at the moment it disables or enables the field onchange event,but the field is enabled anyhow when I edit the page,so if I had value selected in the field where it disables the field and save it and edit it the field is not disabled because that only happens on onchange event and I still need it to be disabled whe edited,so I was thinking that hiding it would be a better idea alltogether,but once again have to find a way how to keep it hidden according to selection in the field when the field is edited as well.


function showChoice()
{
if (document.myForm.Commissionable.value == 'Yes') {
document.myForm.PropertyDetailsName.enabled=true;
}
else {
document.myForm.PropertyDetailsName.enabled=false;
}
}

I hope this makes sense and somebody can help.

Regards and thanks
Reply With Quote
  #2 (permalink)  
Old 10-22-04, 02:03
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Code:
function showChoice()
{
if (document.myForm.Commissionable.value == 'Yes') {
  document.myForm.PropertyDetailsName.enabled=true;
  document.myForm.PropertyDetailsName.style.visibility=visible;
  document.myForm.PropertyDetailsName.display=block;
  }
else {
  document.myForm.PropertyDetailsName.enabled=false; 
  document.myForm.PropertyDetailsName.style.visibility=hidden;
  document.myForm.PropertyDetailsName.display=none;
  }
}
Reply With Quote
  #3 (permalink)  
Old 10-22-04, 02:04
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
not sure why there is that gap in visibility.....
Reply With Quote
  #4 (permalink)  
Old 10-22-04, 02:18
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
thanks for your help, I am getting all sorts of errors at the moment but I will look at it first and see if this will take me anywhere.

Have a nice weekend
Reply With Quote
  #5 (permalink)  
Old 10-22-04, 02:28
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
damn, I duffed it...
Code:
function showChoice()
{
if (document.myForm.Commissionable.value == 'Yes') {
  document.myForm.PropertyDetailsName.enabled=true;
  document.myForm.PropertyDetailsName.style.visibility='visible';
  document.myForm.PropertyDetailsName.style.display='block';  
  }
else {
  document.myForm.PropertyDetailsName.enabled=false;   
  document.myForm.PropertyDetailsName.style.visibility='hidden';
  document.myForm.PropertyDetailsName.style.display='none';  
  }
}
Reply With Quote
  #6 (permalink)  
Old 10-22-04, 02:29
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Actually I can't find anything about this error I am not sure if it's the property that is used is not correct or if the field name is incorrect,but then that doesn't make sense

this is the line where the error is

window.thisForm.CommissionRate.style.visibility=hi dden;
Reply With Quote
  #7 (permalink)  
Old 10-22-04, 02:34
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
you might need to use quotes around it... actually the way I normally do it is to have a hidden and visible class defined in my stylesheet like this....

Code:
.Hidden
{
    DISPLAY: none;
    VISIBILITY: hidden
}
.Visible
{
    VISIBILITY: visible;
    DISPLAY: block;
}
Then I can just do this...
Code:
function showMemberAgreement() {
    var col = document.getElementById('MemberAgreement');
    if(col.className == 'Visible') {
        col.className = 'Hidden';
        col.style.display = 'none';
    }
    else {
        col.className = 'Visible';
        col.style.display = 'block';
    }
}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On