JavaScript: radio button

  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

Good day to all...
i need script for my html code.

Code: [ Select ]
BirthPlace is:<br>
<INPUT CHECKED name="Brgy" type="radio" value="Brgy">Brgy&&
<INPUT name="MuniCity" type="radio" value="MuniCity">Muni/city&&
<INPUT name="Province" type="radio" value="Province">Province<hr>
BirthPlace:<br>
<select name="BirthPlace">
<option value="Marikina">MARIKINA
<option value="Mandaluyong">MANDALUYONG
<option value="Malabon">MALABON
<option value="Makati">MAKATI
<option value="Makati">MANILA</select>
  1. BirthPlace is:<br>
  2. <INPUT CHECKED name="Brgy" type="radio" value="Brgy">Brgy&&
  3. <INPUT name="MuniCity" type="radio" value="MuniCity">Muni/city&&
  4. <INPUT name="Province" type="radio" value="Province">Province<hr>
  5. BirthPlace:<br>
  6. <select name="BirthPlace">
  7. <option value="Marikina">MARIKINA
  8. <option value="Mandaluyong">MANDALUYONG
  9. <option value="Malabon">MALABON
  10. <option value="Makati">MAKATI
  11. <option value="Makati">MANILA</select>


What i want to have in a script for my 3 radio buttons was by clicking it, it will change the value of the selectinput by its corresponding list. and heres my sample list..

list for Brgy:
50THD-OZAM
ABABA-BALB
BALAB-KIDA
CALIC-BABA
GUTAO-DINE
...

list for MuniCity:
AGON
AJUY
BALM
CAGW
CAJI
LUPI
MABT
...

list for Province
Province
KAL
ILO
LEY
ILN
SUL
MET
ANT
SUL
...

any kind of help will appreciated. thank you in advance..
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Include a dropdown menu next to the radio buttons.
Keep everything else as is.

It should be no more complex than that and if you know this much about forms, I assume you can generate the dropdown menus. You may have to create a table to get the cosmetic appearance to look good on the page.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

I'm not sure I understand what you're trying to do. Did you mean that you want to add another select drop-down menu and have the radio buttons determine which list is shown to the user?

This can be done but then they will only be able to select an item from one of the the three lists. In other words they can't choose a selection from "Brgy", "Muni/city", and "Province" but only from the list which is showing and that will depend on which radio button is chosen.

If you need them to select from all three lists then you should just add three separate drop-down selects as ATNO/TW suggests.

If you really want to add a dynamically changing menu with three different lists you could try this code, although I'm not sure it's necessarily the best way of doing it and it won't work in older browsers like Netscape 4.

Also all the radio buttons must have the same name since only one can be chosen and you will probably want to add some code to validate the form to make sure that the user doesn't accidentally submit one of the empty values that I used to make the lists the same length. There is probably a way to do this with lists of different lengths, but I didn't have enought time to look into it and I'm not sure this is even what you want.

Code: [ Select ]
<html>
<head>
<script>
function setList(theList) {
    switch (theList) {
        case 1 : {
        document.theForm.mySelect.options[0].value="50THD-OZAM";
        document.theForm.mySelect.options[1].value="ABABA-BALB";
        document.theForm.mySelect.options[2].value="BALAB-KIDA";
        document.theForm.mySelect.options[3].value="CALIC-BABA";
        document.theForm.mySelect.options[4].value="GUTAO-DINE";
        document.theForm.mySelect.options[5].value="";
        document.theForm.mySelect.options[6].value="";
        document.theForm.mySelect.options[7].value="";
        document.theForm.mySelect.options[0].selected=true;
        document.theForm.radioButton[0].checked=true;
        break;
    }
        case 2 : {
        document.theForm.mySelect.options[0].value="AGON";
        document.theForm.mySelect.options[1].value="AJUY";
        document.theForm.mySelect.options[2].value="BALM";
        document.theForm.mySelect.options[3].value="CAGW";
        document.theForm.mySelect.options[4].value="CAJI";
        document.theForm.mySelect.options[5].value="LUPI";
        document.theForm.mySelect.options[6].value="MABT";
        document.theForm.mySelect.options[7].value="";
        document.theForm.mySelect.options[0].selected=true;
        document.theForm.radioButton[1].checked=true;
        break;
    }
        case 3 : {
        document.theForm.mySelect.options[0].value="KAL";
        document.theForm.mySelect.options[1].value="ILO ";
        document.theForm.mySelect.options[2].value="LEY";
        document.theForm.mySelect.options[3].value="ILN ";
        document.theForm.mySelect.options[4].value="SUL";
        document.theForm.mySelect.options[5].value="MET";
        document.theForm.mySelect.options[6].value="ANT";
        document.theForm.mySelect.options[7].value="SUL";
        document.theForm.mySelect.options[0].selected=true;
        document.theForm.radioButton[2].checked=true;
        break;
    }

}
setOptionText();
}

function setOptionText() {
document.theForm.mySelect.options[0].text=document.theForm.mySelect.options[0].value;
document.theForm.mySelect.options[1].text=document.theForm.mySelect.options[1].value;
document.theForm.mySelect.options[2].text=document.theForm.mySelect.options[2].value;
document.theForm.mySelect.options[3].text=document.theForm.mySelect.options[3].value;
document.theForm.mySelect.options[4].text=document.theForm.mySelect.options[4].value;
document.theForm.mySelect.options[5].text=document.theForm.mySelect.options[5].value;
document.theForm.mySelect.options[6].text=document.theForm.mySelect.options[6].value;
document.theForm.mySelect.options[7].text=document.theForm.mySelect.options[7].value;
}
</script>

</head>
<body onload="setList(1)">
<form name="theForm" onreset="setList(1)">
BirthPlace is:<br>
<input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
<input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
<input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
BirthPlace:<br>
<select name="BirthPlace">
<option value="Marikina" selected>MARIKINA
<option value="Mandaluyong">MANDALUYONG
<option value="Malabon">MALABON
<option value="Makati">MAKATI
</select>
<select name="mySelect">
<option value="50THD-OZAM" selected>50THD-OZAM</option>
<option value="ABABA-BALB">ABABA-BALB</option>
<option value="BALAB-KIDA">BALAB-KIDA</option>
<option value="CALIC-BABA">CALIC-BABA</option>
<option value="GUTAO-DINE">GUTAO-DINE</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
<br><br>
<input type="submit">
</form>
</body>
</html>
  1. <html>
  2. <head>
  3. <script>
  4. function setList(theList) {
  5.     switch (theList) {
  6.         case 1 : {
  7.         document.theForm.mySelect.options[0].value="50THD-OZAM";
  8.         document.theForm.mySelect.options[1].value="ABABA-BALB";
  9.         document.theForm.mySelect.options[2].value="BALAB-KIDA";
  10.         document.theForm.mySelect.options[3].value="CALIC-BABA";
  11.         document.theForm.mySelect.options[4].value="GUTAO-DINE";
  12.         document.theForm.mySelect.options[5].value="";
  13.         document.theForm.mySelect.options[6].value="";
  14.         document.theForm.mySelect.options[7].value="";
  15.         document.theForm.mySelect.options[0].selected=true;
  16.         document.theForm.radioButton[0].checked=true;
  17.         break;
  18.     }
  19.         case 2 : {
  20.         document.theForm.mySelect.options[0].value="AGON";
  21.         document.theForm.mySelect.options[1].value="AJUY";
  22.         document.theForm.mySelect.options[2].value="BALM";
  23.         document.theForm.mySelect.options[3].value="CAGW";
  24.         document.theForm.mySelect.options[4].value="CAJI";
  25.         document.theForm.mySelect.options[5].value="LUPI";
  26.         document.theForm.mySelect.options[6].value="MABT";
  27.         document.theForm.mySelect.options[7].value="";
  28.         document.theForm.mySelect.options[0].selected=true;
  29.         document.theForm.radioButton[1].checked=true;
  30.         break;
  31.     }
  32.         case 3 : {
  33.         document.theForm.mySelect.options[0].value="KAL";
  34.         document.theForm.mySelect.options[1].value="ILO ";
  35.         document.theForm.mySelect.options[2].value="LEY";
  36.         document.theForm.mySelect.options[3].value="ILN ";
  37.         document.theForm.mySelect.options[4].value="SUL";
  38.         document.theForm.mySelect.options[5].value="MET";
  39.         document.theForm.mySelect.options[6].value="ANT";
  40.         document.theForm.mySelect.options[7].value="SUL";
  41.         document.theForm.mySelect.options[0].selected=true;
  42.         document.theForm.radioButton[2].checked=true;
  43.         break;
  44.     }
  45. }
  46. setOptionText();
  47. }
  48. function setOptionText() {
  49. document.theForm.mySelect.options[0].text=document.theForm.mySelect.options[0].value;
  50. document.theForm.mySelect.options[1].text=document.theForm.mySelect.options[1].value;
  51. document.theForm.mySelect.options[2].text=document.theForm.mySelect.options[2].value;
  52. document.theForm.mySelect.options[3].text=document.theForm.mySelect.options[3].value;
  53. document.theForm.mySelect.options[4].text=document.theForm.mySelect.options[4].value;
  54. document.theForm.mySelect.options[5].text=document.theForm.mySelect.options[5].value;
  55. document.theForm.mySelect.options[6].text=document.theForm.mySelect.options[6].value;
  56. document.theForm.mySelect.options[7].text=document.theForm.mySelect.options[7].value;
  57. }
  58. </script>
  59. </head>
  60. <body onload="setList(1)">
  61. <form name="theForm" onreset="setList(1)">
  62. BirthPlace is:<br>
  63. <input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
  64. <input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
  65. <input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
  66. BirthPlace:<br>
  67. <select name="BirthPlace">
  68. <option value="Marikina" selected>MARIKINA
  69. <option value="Mandaluyong">MANDALUYONG
  70. <option value="Malabon">MALABON
  71. <option value="Makati">MAKATI
  72. </select>
  73. <select name="mySelect">
  74. <option value="50THD-OZAM" selected>50THD-OZAM</option>
  75. <option value="ABABA-BALB">ABABA-BALB</option>
  76. <option value="BALAB-KIDA">BALAB-KIDA</option>
  77. <option value="CALIC-BABA">CALIC-BABA</option>
  78. <option value="GUTAO-DINE">GUTAO-DINE</option>
  79. <option value=""></option>
  80. <option value=""></option>
  81. <option value=""></option>
  82. </select>
  83. <br><br>
  84. <input type="submit">
  85. </form>
  86. </body>
  87. </html>
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

RichB wrote:
I'm not sure I understand what you're trying to do. Did you mean that you want to add another select drop-down menu and have the radio buttons determine which list is shown to the user?

This can be done but then they will only be able to select an item from one of the the three lists. In other words they can't choose a selection from "Brgy", "Muni/city", and "Province" but only from the list which is showing and that will depend on which radio button is chosen.


Yes this is it what im trying to do with my radio button and select menu..

Code: [ Select ]
<html>
<head>
</head>
<body onload="setList(1)">
<form name="theForm" onreset="setList(1)">
BirthPlace is:<br>
<input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
<input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
<input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
BirthPlace:<br>
<select name="mySelect">
<option value="50THD-OZAM" selected>50THD-OZAM</option>
<option value="ABABA-BALB">ABABA-BALB</option>
<option value="BALAB-KIDA">BALAB-KIDA</option>
<option value="CALIC-BABA">CALIC-BABA</option>
<option value="GUTAO-DINE">GUTAO-DINE</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
<br><br>
<input type="submit">
</form>
</body>
</html>
  1. <html>
  2. <head>
  3. </head>
  4. <body onload="setList(1)">
  5. <form name="theForm" onreset="setList(1)">
  6. BirthPlace is:<br>
  7. <input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
  8. <input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
  9. <input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
  10. BirthPlace:<br>
  11. <select name="mySelect">
  12. <option value="50THD-OZAM" selected>50THD-OZAM</option>
  13. <option value="ABABA-BALB">ABABA-BALB</option>
  14. <option value="BALAB-KIDA">BALAB-KIDA</option>
  15. <option value="CALIC-BABA">CALIC-BABA</option>
  16. <option value="GUTAO-DINE">GUTAO-DINE</option>
  17. <option value=""></option>
  18. <option value=""></option>
  19. <option value=""></option>
  20. </select>
  21. <br><br>
  22. <input type="submit">
  23. </form>
  24. </body>
  25. </html>


Thanks in a million, its a big help from you.. :D
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

i play around with the code you gave me and i found some encoding time prolonging on the side of script. :shock:


Code: [ Select ]
function setList(theList) {
  switch (theList) {
   case 1 : {
   document.theForm.mySelect.options[0].value="50THD-OZAM";
   document.theForm.mySelect.options[1].value="ABABA-BALB";
   document.theForm.mySelect.options[2].value="BALAB-KIDA";
   document.theForm.mySelect.options[3].value="CALIC-BABA";
   document.theForm.mySelect.options[4].value="GUTAO-DINE";
   document.theForm.mySelect.options[5].value="";
   document.theForm.mySelect.options[6].value="";
   document.theForm.mySelect.options[7].value="";
   document.theForm.mySelect.options[0].selected=true;
   document.theForm.radioButton[0].checked=true;
   break;
  }
   case 2 : {
   document.theForm.mySelect.options[0].value="AGON";
   document.theForm.mySelect.options[1].value="AJUY";
   document.theForm.mySelect.options[2].value="BALM";
   document.theForm.mySelect.options[3].value="CAGW";
   document.theForm.mySelect.options[4].value="CAJI";
   document.theForm.mySelect.options[5].value="LUPI";
   document.theForm.mySelect.options[6].value="MABT";
   document.theForm.mySelect.options[7].value="";
   document.theForm.mySelect.options[0].selected=true;
   document.theForm.radioButton[1].checked=true;
   break;
  }
   case 3 : {
   document.theForm.mySelect.options[0].value="KAL";
   document.theForm.mySelect.options[1].value="ILO ";
   document.theForm.mySelect.options[2].value="LEY";
   document.theForm.mySelect.options[3].value="ILN ";
   document.theForm.mySelect.options[4].value="SUL";
   document.theForm.mySelect.options[5].value="MET";
   document.theForm.mySelect.options[6].value="ANT";
   document.theForm.mySelect.options[7].value="SUL";
   document.theForm.mySelect.options[0].selected=true;
   document.theForm.radioButton[2].checked=true;
   break;
  }

}
  1. function setList(theList) {
  2.   switch (theList) {
  3.    case 1 : {
  4.    document.theForm.mySelect.options[0].value="50THD-OZAM";
  5.    document.theForm.mySelect.options[1].value="ABABA-BALB";
  6.    document.theForm.mySelect.options[2].value="BALAB-KIDA";
  7.    document.theForm.mySelect.options[3].value="CALIC-BABA";
  8.    document.theForm.mySelect.options[4].value="GUTAO-DINE";
  9.    document.theForm.mySelect.options[5].value="";
  10.    document.theForm.mySelect.options[6].value="";
  11.    document.theForm.mySelect.options[7].value="";
  12.    document.theForm.mySelect.options[0].selected=true;
  13.    document.theForm.radioButton[0].checked=true;
  14.    break;
  15.   }
  16.    case 2 : {
  17.    document.theForm.mySelect.options[0].value="AGON";
  18.    document.theForm.mySelect.options[1].value="AJUY";
  19.    document.theForm.mySelect.options[2].value="BALM";
  20.    document.theForm.mySelect.options[3].value="CAGW";
  21.    document.theForm.mySelect.options[4].value="CAJI";
  22.    document.theForm.mySelect.options[5].value="LUPI";
  23.    document.theForm.mySelect.options[6].value="MABT";
  24.    document.theForm.mySelect.options[7].value="";
  25.    document.theForm.mySelect.options[0].selected=true;
  26.    document.theForm.radioButton[1].checked=true;
  27.    break;
  28.   }
  29.    case 3 : {
  30.    document.theForm.mySelect.options[0].value="KAL";
  31.    document.theForm.mySelect.options[1].value="ILO ";
  32.    document.theForm.mySelect.options[2].value="LEY";
  33.    document.theForm.mySelect.options[3].value="ILN ";
  34.    document.theForm.mySelect.options[4].value="SUL";
  35.    document.theForm.mySelect.options[5].value="MET";
  36.    document.theForm.mySelect.options[6].value="ANT";
  37.    document.theForm.mySelect.options[7].value="SUL";
  38.    document.theForm.mySelect.options[0].selected=true;
  39.    document.theForm.radioButton[2].checked=true;
  40.    break;
  41.   }
  42. }


the maximum number of my list from menu was over a thousand[Barangay] and the minimum was 200+[Province]. so that means, i will also encode with this document.theForm.mySelect.options[number].value=""; :cry:

thus any other way of fixing or reviced this code to reduce of time from encoding??
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Yikes! I had no idea you had lists that long. :shock:

There's no easy way to create that with client-side javascript. If you already have the information in a text file or a database and access to a server-side scripting language like php you could generate the lists dynamically by extracting the data from the database/file and printing it to the page inside a loop that does the work for you.

If you already have the information for the lists in text files - say a text file for Barangay, a text file for Provinces and one for Muni/City, then you could email me the text files and I could try to generate the html file and send it back to you, but I don't think it will work in a plain html file with that many items. I thought those were the lists.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Not to mention it will take some browsers forever to parse! Wow!
I think RichB is right -- use a database and php or asp, and break it down into smaller segments (perhaps alphabetically).

That's a tough little problem you have there. Unfortunately I don't have any good solutions to offer.
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

RichB wrote:
Yikes! I had no idea you had lists that long. :shock:

There's no easy way to create that with client-side javascript. If you already have the information in a text file or a database and access to a server-side scripting language like php you could generate the lists dynamically by extracting the data from the database/file and printing it to the page inside a loop that does the work for you.

If you already have the information for the lists in text files - say a text file for Barangay, a text file for Provinces and one for Muni/City, then you could email me the text files and I could try to generate the html file and send it back to you, but I don't think it will work in a plain html file with that many items. I thought those were the lists.


Hi there again RichB. Thanks for the comment and you also ATNO/TW..
at this time only html i know how to work with my data. i dont have yet knowledge around in php+sql. But then again thanks for askin me to email you the Barangay,Municipality and Province text and actualy i have them..
yeah your both right coz the past week end i played around with code to feed all the list i have. and when i finished and testing it the page loading so much time until it will not respond and hang. im really naive to that not thinking of time consumed is just a waiste. :cry: i guess this is shortcoming for a novice like me..

the next post is for RichB and ATNO/TW: txt file; brgy,minu,prov..
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Learning PHP, ASP and SQL is not as hard as you think. A few weeks ago I knew nothing about PHP or SQL, now I feel I have enough knowledge to say I'm slightly past the beginner stage. And ASP is very close to PHP when it comes to databases because it uses the same SQL functions that PHP does (for the most part).

It's just a matter of whether you have the time to do a little learning to do it right. I think in your case it would be worth the effort. There's lot's of folks around here that seem more than willing to help when you run into problems.
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

RichB wrote:
Yikes! I had no idea you had lists that long. :shock:

There's no easy way to create that with client-side javascript. If you already have the information in a text file or a database and access to a server-side scripting language like php you could generate the lists dynamically by extracting the data from the database/file and printing it to the page inside a loop that does the work for you.

If you already have the information for the lists in text files - say a text file for Barangay, a text file for Provinces and one for Muni/City, then you could email me the text files and I could try to generate the html file and send it back to you, but I don't think it will work in a plain html file with that many items. I thought those were the lists.


I hope that you receive my email to you about the data in txt format..

to ATNO/TW would you like also to see the list of my data?

thanks for your help guys..
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Sure. I just sent you my email addy in Private message.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Outlook express wouldn't let me download the attachment because it considered it unsafe. I'm not sure why because I don't use Outlook express all that much and I'm not that familiar with it, but my web-based email kept hanging when I tried to access it, so I tried to pull it down with OE and didn't have any luck.

Anyway, I wouldn't be able to do anything other than generate a static html file using a script to insert the data. That would have saved you the time of copying and pasting, but as you said in your earlier post it looks like a list that long will hang the browser, so I think you're going to have to look for another solution.

Perhaps until you find a workable way to present the data to the user, you could just have them enter the data in text fields. I know this is not an ideal solution, but I can't think of another way at the moment, and a list of 1,000 items is just too long to work. :(
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

Can we use this txt file as an ini file and make a script to use it to load into html page?? is that possible??


RichB wrote:
Outlook express wouldn't let me download the attachment because it considered it unsafe. I'm not sure why because I don't use Outlook express all that much and I'm not that familiar with it, but my web-based email kept hanging when I tried to access it, so I tried to pull it down with OE and didn't have any luck.

Anyway, I wouldn't be able to do anything other than generate a static html file using a script to insert the data. That would have saved you the time of copying and pasting, but as you said in your earlier post it looks like a list that long will hang the browser, so I think you're going to have to look for another solution.

Perhaps until you find a workable way to present the data to the user, you could just have them enter the data in text fields. I know this is not an ideal solution, but I can't think of another way at the moment, and a list of 1,000 items is just too long to work. :(
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Simple fix for that RichB
Go to Tools|Options. On the security tab uncheck "Do not allow attachments to be saved or opened that could potentially be a virus."
Click Apply or OK and refresh OE -- you should then be able to save or open the attachment.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Thanks ATNO/TW, I've got 'em now. Not sure if I'll be able to do much with them, but I'll give it a shot and see what happens.
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

back to the last script we give me.. thats really works and i add some lines in disabled function..
Code: [ Select ]
document.getElementById("NominaterLN").value="";
document.getElementById("NominaterFN").value="";
document.getElementById("NominaterMN").value="";
document.getElementById("NominaterNS").value="";
  1. document.getElementById("NominaterLN").value="";
  2. document.getElementById("NominaterFN").value="";
  3. document.getElementById("NominaterMN").value="";
  4. document.getElementById("NominaterNS").value="";

what about in NominaterTitle, i try this line
Code: [ Select ]
document.getElementById("NominaterTitle").options.selectedIndex.text="";

but it doesnt work.
...what should be the object to call to get the selected value return to -1 or empty value??
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Vickriz the biggest problem is the size. You've already noticed the lag time and the browser hang up. If you put it into a database you can code the scripting language (ASP/PHP or whatever) to display only portions at a time. i.e page 1, page 2 etc...just like this forum script does.

The only other thing I can think to do it in HTML is to break down your largest files alphabetically, then do dropdowns to select from the letters, then use "CASE" to switch to the cities based on the alphabetical letter selected.

That's off the top of my head, but I think it would work.
  • vickriz
  • Novice
  • Novice
  • User avatar
  • Posts: 31
  • Loc: Phlippines

Post 3+ Months Ago

ATNO/TW wrote:
Vickriz the biggest problem is the size. You've already noticed the lag time and the browser hang up. If you put it into a database you can code the scripting language (ASP/PHP or whatever) to display only portions at a time. i.e page 1, page 2 etc...just like this forum script does.

The only other thing I can think to do it in HTML is to break down your largest files alphabetically, then do dropdowns to select from the letters, then use "CASE" to switch to the cities based on the alphabetical letter selected.

That's off the top of my head, but I think it would work.


thats a good idea i've heared.. well i hope you can help me to put them in the box..
i have to start work with PHP now. actually we used postgresql as back-end for data access but i dont have background niether. just a little read about sql statements...
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

*smiles -- I charge $95.00 US an hour for custom scripting. It looks like you have the ability to do that one on your own. Just follow the idea I presented and use an extended version of the switch and case options RichB gave in his earliest thread and I think you'll get it.

I'll be more than happy to help if you run into a snag and I can figure it out.

P.S. You don't need to quote us every time you post. Unless it's unclear what you're refering to, the added quote text just eats extra bandwidth. We pretty much know what you're refering to.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

In regards to the last script I gave you:

add this line to the disable function for "NominaterTitle".

Code: [ Select ]
document.getElementById("NominaterTitle").selectedIndex=0;


Unfortunately I don't have a solution for the multiple lists problem. The combined size of the text files you sent me is nearly one megabyte and there are over 44,000 items in the files. I think you might have to hire someone to make you a custom solution for that. I'm throwing in the towel on that one.

Post Information

  • Total Posts in this topic: 20 posts
  • Users browsing this forum: ScottG and 115 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.