Add to Google

Dynamic selecting form - I did it.

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Dynamic selecting form - I did it.

LuciferStar
Sorry there's no comment.

form.html[br]
CODE
<html><head><script  language=javascript src="form.js"></script>[/br]</head>[br]<body onload=show(0)>[/br]</body></html>


form.js[br]
CODE
[/br]mainboardcontent=new Array("8","abit","asus", "epox", "giga","intel","iwill","msi","others", 5,"intel", "via", "nvidia", "sis","others",4,"socket478","socket462(A)","socket370","other",3,"ddr","sdr","other",4,"soundblast","videocard","netcard","other");[br]harddcontent=new Array("6","maxtor","samsung", "hitach", "westerndata","seagate","others", 6,"40GB", "60GB", "80GB", "120GB", "160GB", "others",3,"5400rpm","7200rpm","other");[/br]cpucontent=new Array("4","Socket478","Socket462", "Socket370", "others", 6,"1M", "512KB", "256KB", "128KB", "64KB", "others",2,"111","222");[br]ramcontent=new Array("4","ddr","sdram", "rambus", "others", 4,"128M", "256KB", "512KB","others");[br][/br]selectdata=new Array("0","manual","1","1",  "1","CPU","2","0",  "2","MAINBOARD","5","0",  "3","RAM","2","0",  "4","HARDDRIVE","3","0");[br][/br][/br]function showdata(data,j)[br]{[/br]    if(j==0)[br]    {[/br]        max=data[j*data[0]];[br]        for(k=1;k<=max;k++)[/br]        {            [br]           document.write("<option value=\""+data[k]+"\">"+data[k]+"</option>");[/br]        }[br]    }[/br]    else[br]    {[/br]        old=++max;[br]        max+=data[max];[/br]        for(k=old+1;k<=max;k++)[br]        {            [br]           document.write("<option value=\""+data[k]+"\">"+data[k]+"</option>");[/br]        }[br]    }[/br]}[/br]function add(i)[br]{[/br]   for(var j=0;j<selectdata[i*4+2];j++)[br]   {[br][/br]      if(selectdata[i*4+3]=="0")[/br]      {[br]         document.write("<br><select name=\"select"+(j+1)+"\">");[br][/br]         switch(i)[/br]         {[br]             case "1": showdata(cpucontent,j);break;[/br]             case "2": showdata(mainboardcontent,j);break;[br]             case "3": showdata(ramcontent,j);break;[/br]             case "4": showdata(harddcontent,j);break;[br]             default:  document.write("<option value=\""+j+"\">"+j+"</option>");break;[/br]         }[br]         document.write("</select>");[/br]      }[br]      else  if(selectdata[i*4+3]=="1")[/br]      {[br]         document.write("<br><input name=\"which"+j+"\"></input>");[/br]      }[br]   }[/br]   document.write("<br><br><input type=submit></input>");[br]}[/br]function show(i)[br]{[/br]   document.write("<html><head><script language=javascript src=form.js></script></head><body>");[br]   document.write("<form name=\"form\" method=\"post\" action=\"\"><select name=\"which\" onchange='draw(this.options[this.selectedIndex].value);'>");[br][/br]   for(var x=0;x<19;x+=4)[br]   {[/br]      if(selectdata[x]==i)[/br]        document.write("<option selected value=\""+selectdata[x]+"\">"+selectdata[x+1]+"</option>");[br]      else[/br]        document.write("<option value=\""+selectdata[x]+"\">"+selectdata[x+1]+"</option>");[br]   }[/br]   document.write("</select><br>");[br]   if(i!=0)[br]   {[/br]      add(i);[br]   }[/br]   document.write("</form></body></html>");[br]}[/br]function init()[br]{[/br]   document.close();[br]}[/br]function draw(i)[br]{[/br]   init();[/br]   show(i);[br]}[/br]

 

 

 


Reply

Ariel
Good Contribution!!!!

Thanksssss!!!

I can put this form in my page??

thanks again

Reply

LuciferStar
QUOTE (Ariel @ Aug 9 2004, 04:13 PM)
Good Contribution!!!!

Thanksssss!!!

I can put this form in my page??

thanks again


SURE! GO AHEAD!

You should modify the data:
such as
mainboardcontent=new Array("8","abit","asus", "epox", "giga","intel","iwill","msi","others", 5,"intel", "via", "nvidia", "sis","others",4,"socket478","socket462(A)","socket370","other",3,"ddr","sdr","other",4,"soundblast","videocard","netcard","other");

datastructure:
1 subselection: selectiongtitle=new Array("1","hello","hola");
2 subselections: selectiongtitle=new Array("1","hello","hola","2","ni hao","bonjour");
3 subselections: selectiongtitle=new Array("1","hello","hola","2","ni hao","bonjour","3","cell1","cell2","cell3");

 

 

 


Reply

logman92
Hello !

In the same idea wink.gif, i discovered another script about customizable forms. You can find all what you know about it at this url Usable forms.

This script shows and hides form fields based on user actions. It is very interesting because it handles radio button and checkbox too !

Try the example on the page, you can test the script and observe the different results.

Reply

LuciferStar
QUOTE (logman92 @ Oct 23 2004, 12:04 PM)
Hello !

In the same idea wink.gif, i discovered another script about customizable forms.

Nice form:)

Reply

logman92
You find it too biggrin.gif

I recently used it in a professional project and it was very easy to integrate it in my existing development.
Documentation about it (refer you to my last post) explains very clearly the manner of applying it in your own code.

Reply

eldeo
Nice form! I think its very interesting

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Similar Topics

Keywords : Dynamic Selecting

  1. Java Script Drop Down Menu With Css - - a full code for a dynamic drop down (2)
    Introduction This is a code that I use to dynamically create the drop down menus. First, you have
    to edit the following code and put it in your Javascript. Notice : /*** SET BUTTON'S FOLDER HERE
    ***/. Edit that to your folder. Also, the /*** SET BUTTONS' FILENAMES HERE ***/. This creates a
    mouseover when the drop down is activated. Put all your onmouseover images under: oversources = new
    array; and your onmouseout images under : upsources. Be sure to set your on and out images above
    each other. CODE /*** SET BUTTON'S FOLDER HERE ***/ var buttonFold...
  2. Dynamic Class Reloading - (2)






Looking for dynamic, selecting, form






*SIMILAR VIDEOS*
Searching Video's for dynamic, selecting, form

*MORE FROM TRAP17.COM*
advertisement



Dynamic selecting form - I did it.