creating drop down list at run time

Results 1 to 2 of 2

Thread: creating drop down list at run time

  1. #1
    Join Date
    Dec 1969

    Default creating drop down list at run time

    hi<BR><BR>I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings, etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100.<BR><BR> i will select any skill in 1st drop down list then i&#039;ll select % of this skill in the 2nd list box , based on the percentage i&#039;ve selected in the 2nd list box it has to display<BR>2 sets of drop down list boxes at run time one for selecting skill and another for selecting percentage of <BR>skills it has to display these listboxes at run time upto total <BR>percentage becomes 100.for e.g if i select java in 1st list <BR>box and 60 in second list box then at run time below these 2 list boxes it has to display another set of drop down lists. where i can select another skill and for this skill i&#039;ll <BR>select percentage.and i&#039;ve to check the percentages <BR>i&#039;ve selected till now to know whether it has reached 100 %, if not i&#039;ve to disaply another set of drop down list boxes.<BR><BR>Hope you got what i said.<BR><BR>so for this wat i thought is to create dropdown list at run it possible to create drop down list at run time with the items.<BR><BR>can any one tell me how to add items to a drop down list which is created at runtime.and how to get the value which i have selected in the drop down using html table on which am placing these controls.<BR>each row in a table is having one control.<BR><BR>so if i want to create drop down list <BR><BR>control at run time i&#039;ve to place it <BR><BR>for e.g. the 2 drop down list boxes are present at 3 row.and i&#039;ve to display newly created ones at 4rth row and so i&#039;ve to insert table row at run time so that i can place newly created drop down list boxes on this.can anybody tell me how to do this one.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default I wouldn't do it this way...

    I&#039;d create perhaps 10 pairs of drop-down lists ahead of time, all with the same content. I would then hide all but the first one by using a style of "display: none".<BR><BR>And then I&#039;d use client-side JavaScript to handle an onChange for each percentage list that would then add up all the percentages (all in browser-side JS code) and, if the total is less than 100%, un-hide the next hidden drop down.<BR><BR>Now, what do you do if the user has a total, in 3 drop-downs, of 90%. And then goes back to the first one and changes its percentage to 90%, so that the toal is more than 100%??? That&#039;s easy to handle in the JS client code: You use an alert to tell them of their mistake and use the same alert each time until the changes they make total 100% or less.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts