IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Dynamic selecting form

, I did it.


LuciferStar
no avatar
Advanced Member
*******
Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



Post #1 post Aug 9 2004, 10:17 AM
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]
Go to the top of the page
+Quote Post
Ariel
no avatar
Member [Level 3]
******
Group: Members
Posts: 94
Joined: 14-July 04
From: Argentina
Member No.: 98



Post #2 post Aug 9 2004, 04:13 PM
Good Contribution!!!!

Thanksssss!!!

I can put this form in my page??

thanks again
Go to the top of the page
+Quote Post
LuciferStar
no avatar
Advanced Member
*******
Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



Post #3 post Aug 10 2004, 01:41 AM
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");
Go to the top of the page
+Quote Post
logman92
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 10
Joined: 22-October 04
From: Paris, France
Member No.: 1,880



Post #4 post Oct 23 2004, 12:04 PM
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.
Go to the top of the page
+Quote Post
LuciferStar
no avatar
Advanced Member
*******
Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



Post #5 post Oct 23 2004, 01:02 PM
QUOTE (logman92 @ Oct 23 2004, 12:04 PM)
Hello !

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

Nice form:)
Go to the top of the page
+Quote Post
logman92
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 10
Joined: 22-October 04
From: Paris, France
Member No.: 1,880



Post #6 post Oct 31 2004, 06:11 PM
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.
Go to the top of the page
+Quote Post
eldeo
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 19
Joined: 10-October 04
Member No.: 1,626



Post #7 post Nov 7 2004, 12:40 PM
Nice form! I think its very interesting
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   13 galexcd 3,217 14th August 2007 - 01:25 PM
Last post by: Galahad
No New Posts   3 Plenoptic 1,410 17th July 2006 - 12:06 PM
Last post by: Plenoptic
No New Posts   5 odomike 10,417 27th October 2004 - 02:29 AM
Last post by: odomike
No New Posts   6 wild20 1,432 8th June 2006 - 10:04 PM
Last post by: wild20
No New Posts 3 finaldesign 12,389 9th December 2004 - 08:46 AM
Last post by: finaldesign
No New Posts   7 cragllo 5,558 14th December 2004 - 01:51 AM
Last post by: khmerneed
No New Posts   0 thablkpanda 4,946 7th December 2004 - 01:25 AM
Last post by: thablkpanda
No New Posts   2 s243a 3,568 8th December 2004 - 03:24 AM
Last post by: thablkpanda
No New Posts   2 FaLgoR 4,122 4th January 2005 - 06:30 PM
Last post by: FaLgoR
No New Posts   0 kvarnerexpress 3,673 11th January 2005 - 09:35 PM
Last post by: kvarnerexpress
No New Posts   1 kkrizka 1,403 21st September 2007 - 07:21 PM
Last post by: delivi
No New Posts   12 Neutrality 5,793 31st August 2006 - 10:49 AM
Last post by: goldrain
No New Posts   7 maddog39 3,763 24th February 2005 - 11:01 PM
Last post by: ill
No New Posts 0 karlo 3,191 24th February 2005 - 12:43 PM
Last post by: karlo
No New Posts   0 RGPHNX 3,875 27th February 2005 - 08:38 PM
Last post by: RGPHNX


 



RSS Open Discussion Time is now: 21st November 2009 - 10:20 PM

Web Hosting Powered by ComputingHost.com.