Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> pole hidden i przenoszenie do niego wartosci, z select'a
Lynn
post
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 12.09.2006

Ostrzeżenie: (0%)
-----


Moj problem polega na tym, ze mam pole slect, ktoro jest wypelniane w nast sposob:
  1. // fcja ktora w zaleznosci od statusu checkboxa wyswietla odp opcje
  2. function sprawdz1() {
  3.  
  4. var tab_intra_naz1 = new Array("intra 15","intra 30","intra 60");
  5. var tab_intra_val1 = new Array("15","30","60");
  6.  
  7. var tab_inne_naz1 = new Array("10 dni","30 dni","90 dni","pol roku","rok");
  8. var tab_inne_val1 = new Array("10","30","90","180","365");
  9.  
  10. if(document.getElementById("intra1").checked)
  11. {
  12. for (i=0;i<3;i++) {
  13. document.getElementById("okr1").options[i]= new Option (tab_intra_naz1[i], tab_intra_val1[i]);
  14. }
  15. }
  16. else if (!document.getElementById("intra1").checked){
  17. for (i=0; i<5;i++){
  18. document.getElementById("okr1").options[i]= new Option (tab_inne_naz1[i], tab_inne_val1[i]);
  19. }
  20. }
  21. }




i ono znajduje sie w jednym formie, naotmiast potrzebuje aby wybrana wartosc z tego select'a poszla do drugiego forma, ktory jest pod spodem. Mianowicie zrobilam w tym formie pole <input type hidden value=? i tu mam problem, jak wstawic ta wartosc wybrana w selectcie?

  1. // html do tego selecta <td><select name="okr1" id="okr1" class="t" >
  2. </select></td>


Ten post edytował Lynn 29.09.2006, 12:22:51
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Lynn
post
Post #2





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 12.09.2006

Ostrzeżenie: (0%)
-----


zrobilam tak:
  1. <?php
  2. <td>intra <input type="Checkbox" name="intra1" value="intra1" id="intra1" onclick="java script:sprawdz1();">
  3. </td>
  4. <script language="JavaScript" type="text/javascript">
  5. // fcja ktora w zaleznosci od statusu checkbox'a wyswietla odp opcje
  6. function sprawdz1() {
  7.  
  8. var tab_intra_naz1 = new Array("intra 15","intra 30","intra 60");
  9. var tab_intra_val1 = new Array("15","30","60");
  10.  
  11. var tab_inne_naz1 = new Array("10 dni","30 dni","90 dni","pol roku","rok");
  12. var tab_inne_val1 = new Array("10","30","90","180","365");
  13.  
  14. if(document.getElementById("intra1").checked) 
  15. {
  16. for (i=0;i<3;i++) {
  17. document.getElementById("okr1").options[i]= new Option (tab_intra_naz1[i], tab_intra_val1[i]); 
  18. }
  19. }
  20. else if (!document.getElementById("intra1").checked){
  21. for (i=0; i<5;i++){
  22. document.getElementById("okr1").options[i]= new Option (tab_inne_naz1[i], tab_inne_val1[i]); 
  23. }
  24. }
  25. }
  26. </script>
  27. <td><select name="okr1" id="okr1" class="t" onchange="document.getElementById('okr11').value=this.value">
  28. </select></td>
  29.  
  30. <form name="wyk" method="get">
  31. <INPUT type="Hidden" name="okr11" id="okr11" value="">
  32. ?>


i nie chce mi dzialac, czy ja cos robie nie tak?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 17:12