Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > read only and editable drop down lists help?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-04, 00:59
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Unhappy read only and editable drop down lists help?

I was hoping somebody would have an example for something similar I need to do here.

I have a drop down box(Yes, no) if users select Yes that is suppose to bring up another drop down list with a list of choices.

I was told by someone that the best way to go about is to create the second drop down list and make it read only, but make it editable when Yes from the previous drop down list is selected.



I suppose java would script would do that, so I was hoping to see if somebody could help me with this, have no code at the moment.

thanks and regards

Last edited by zobernjik : 10-01-04 at 02:04.
Reply With Quote
  #2 (permalink)  
Old 10-04-04, 20:16
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
Okie.... when you write your second combo box include the attribute enabled="false".

In your yes/no combo box add an on change event ( onchange="showChoices(); )

Then include code similar to this in your header area of your page
Code:
function showChoice() if document.form.combo1.value = "Yes" { document.form.combo2.enabled=true; } else { document.form.combo2.enabled=false } }
Reply With Quote
  #3 (permalink)  
Old 10-05-04, 20:54
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
I hate java and I don't know how to write java.
Rokslide,thaks for your help I followed your suggestion i have place java cript in between java cript tags,created function I am calling onchange event, and then when I load the page it gives me an error "Line 39 Expected'}" which is basically an error in the middle of javascript function, and if I take the code out you helped me with the error disappears.

And then if click the error off and try to select Yes from the combo box to execute the code i get an error "Object Expected" line 65" which is the last line of the function you helped me with, it is } and that is it.

I have tried to do the same with this code

function Populate_onchange()
{

if(document.getElementsByID("Commissionable").valu e=='Yes')
{document.getElementsByID("PropertyDetailsName").s tyle.display='';}
else
{document.getElementsByID("PropertyDetailsName").s tyle.display='none';}
}
and I get an error that object doesn't support this property or method.


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


All of this looks so simple but I can't make it work it is driving me nuts

Last edited by zobernjik : 10-05-04 at 20:57.
Reply With Quote
  #4 (permalink)  
Old 10-05-04, 21:00
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
I hate java and I don't know how to write java.
Rokslide,thaks for your help I followed your suggestion i have place java cript in between java cript tags,created function I am calling onchange event, and then when I load the page it gives me an error "Line 39 Expected'}" which is basically an error in the middle of javascript function, and if I take the code out you helped me with the error disappears.

And then if click the error off and try to selected Yes from the combo box to execute the code i get an error "Object Expected" line 65" which is the last line of the function you helped me with, it is } and that is it.

I have tried to do the same with this code

function Populate_onchange()
{

if(document.getElementsByID("Commissionable").valu e=='Yes')
{document.getElementsByID("PropertyDetailsName").s tyle.display='';}
else
{document.getElementsByID("PropertyDetailsName").s tyle.display='none';}
}
and I get an error that object doesn't support this property or method.


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


All of this looks so simple but I can't make it work it is driving me nuts
Reply With Quote
  #5 (permalink)  
Old 10-05-04, 21:21
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
okie, change my function to work better with your other one....
Code:
function showChoice() var Comm = document.getElementsByID("Commissionable") var PropDet = document.getElementsByID("PropertyDetailsName") if Comm.value = "Yes" { PropDet.enabled=true; } else { PropDet.enabled=false; } }
and for your other version..
Code:
function Populate_onchange() { if(document.getElementsByID("Commissionable").value=='Yes'){ document.getElementsByID("PropertyDetailsName").style.visibility='visible'; document.getElementsByID("PropertyDetailsName").style.display='block'; } else { document.getElementsByID("PropertyDetailsName").style.visibility='hidden'; document.getElementsByID("PropertyDetailsName").style.display='none'; } }
let me know how it goes...
Reply With Quote
  #6 (permalink)  
Old 10-10-04, 20:48
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Is there a limitation when it comes to using GetElementsByID as if I use it and see no reason why this code woudn't work it gives me an error that "Object doesn't support this property or method".
Reply With Quote
  #7 (permalink)  
Old 10-10-04, 23:36
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
I don't think it is a limitation, just perhaps a problem with the way we are calling it. I'll have a bit more of a look for you...

doh! try disabled = false instead of enabled = true and disabled = true instead of enabled = false.

The property is disabled, not enabled.

Last edited by rokslide : 10-10-04 at 23:42.
Reply With Quote
  #8 (permalink)  
Old 10-11-04, 00:06
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Sorry to do this to you again and thanks once again.

I forgot to say that i have tried those options and also forgot to say that If i call function showChoice() on selection of yes/no error is "document.myForm.Commissionable is not null or not an object"

and if I call Populate_onchange()then error is "object doesn't support this property or method"

I have spoken to my senior programmer who doesn't seems to be willing to help, so i am just compeletely stuck on something that was suppose to be easier.

Cheers
Reply With Quote
  #9 (permalink)  
Old 10-11-04, 00:59
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
can you post the completely generated html and javascript as an attachment? I'll look into it more...
Reply With Quote
  #10 (permalink)  
Old 10-11-04, 01:26
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
thanks once again, this particular page is big and very customized so there are many functions,etc, so I have taken most of it out and left only fields that I need including some others not important when it comes to my problem.

I have highlighted two functions and the code for the Commissionable field so you can see the way I am calling it.

I have tried to take everything out correclty but in word it gets hard to follow the code so I have done the best I could, if this is messy I can send the complete code.

Thanks a lot and regards
Attached Files
File Type: doc help_doc.doc (89.0 KB, 52 views)
Reply With Quote
  #11 (permalink)  
Old 10-11-04, 01:37
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
rather then posting the asp which I can't really use locally can you call up the page in a web browser and save the html and attach that?
Reply With Quote
  #12 (permalink)  
Old 10-11-04, 02:01
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Unhappy

Pardon my ignorance, by that do you mean to hit F12 in order to preview this page and if that is it I can't do it,I mean I can but it errors, as my senior programmer is doing things in his very own way,unless you can suggest me a different way.
Reply With Quote
  #13 (permalink)  
Old 10-11-04, 02:04
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
What I am meaning is that with all the vbscript in this thing that generated all the combos I can't really test the javascript and see what it is doing.

Normally what you would do is call up the page in IE or Netscape and then view the source code and save the result.
Reply With Quote
  #14 (permalink)  
Old 10-11-04, 02:07
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Here comes the source code of my edit page
Attached Files
File Type: txt EditDestAccommodation.txt (107.3 KB, 58 views)
Reply With Quote
  #15 (permalink)  
Old 10-11-04, 02:20
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
One of your problems comes from the call to calculate amount in the window_onload event.
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

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