HighDots Forums  

Re: new fields to magically appear

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Re: new fields to magically appear in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gary White
 
Posts: n/a

Default Re: new fields to magically appear - 11-01-2004 , 09:57 AM






rbrynest wrote:


Not sure what you're trying to do, but this is wrong:

Quote:
ipt=Array("text1","text3");
f=s.form;
v=s.options[s.selectedIndex].value;
for(i=0;i<ipt.length;i++){
f.elements[ipt].style.display=v==opt?"block":"none";
}

You assign the array of input names to the variable "ipt". You then try
to use that "ipt" array as an index into the form's elements collection.
Try changing this line:

f.elements[ipt].style.display=v==opt?"block":"none";

To this:

f.elements[ipt[i]].style.display=v==opt?"block":"none";


Gary


Reply With Quote
  #2  
Old   
rbrynest
 
Posts: n/a

Default Re: new fields to magically appear - 11-01-2004 , 04:38 PM






I stil get the same error.

Try changing this line:

f.elements[ipt].style.display=v==opt?"block":"none";

To this:

f.elements[ipt].style.display=v==opt?"block":"none";

Reply With Quote
  #3  
Old   
Gary White
 
Posts: n/a

Default Re: new fields to magically appear - 11-01-2004 , 04:57 PM



rbrynest wrote:

Quote:
I stil get the same error.
Sorry, I missed that you were doing the same thing with the opt
variable. Here is the complete working function:

function setInput(s){
// array of the options that activate the text inputs
opt=Array("1","3");
// array of the text input id's
ipt=Array("text1","text3");
f=s.form;
v=s.options[s.selectedIndex].value;
for(i=0;i<ipt.length;i++){
f.elements[ipt[i]].style.display=(v==opt[i]?"block":"none");
}
}


Gary


Reply With Quote
  #4  
Old   
rbrynest
 
Posts: n/a

Default Re: new fields to magically appear - 11-02-2004 , 03:11 AM



Sorry Gary, stil the same error

Reply With Quote
  #5  
Old   
Gary White
 
Posts: n/a

Default Re: new fields to magically appear - 11-02-2004 , 08:09 AM



rbrynest wrote:

Quote:
Sorry Gary, stil the same error

It doesn't for me. See here: http://apptools.com/newsgroup/rbrynest.html


Gary


Reply With Quote
  #6  
Old   
rbrynest
 
Posts: n/a

Default Re: new fields to magically appear - 11-02-2004 , 08:51 AM



When i use your source it works for me too. Maybe it has something to do with the line breaks. Thank you very much for your help and your patience Gary

Reply With Quote
  #7  
Old   
Gary White
 
Posts: n/a

Default Re: new fields to magically appear - 11-02-2004 , 11:28 AM



rbrynest wrote:

Quote:
When i use your source it works for me too. Maybe it has something to
do with the line breaks. Thank you very much for your help and your
patience Gary
You're welcome. If you can upload yours somewhere and post a link,
perhaps I can spot the problem.


Gary


Reply With Quote
Reply




Thread Tools
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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.