🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
4 messages
4 total messages Started by Krystian Fri, 02 Apr 2010 20:20
Select z 2 zależnych od siebie list i bład [object HTMLSelectElement]
#49909
Author: Krystian
Date: Fri, 02 Apr 2010 20:20
38 lines
2326 bytes
Witam,

Mam problem, tworzę stronkę przy pomocy js i axjaxa i problem mam
następujący problem:

W momencie zmiany opci w 1 selectie wywołuję funkcję za pomocą:
<select id="list1" name="list1" onChange="javascript:showList(this);">

Funkcja w javie z ajaxem który ma to przetworzyć i stworzyć nowe
drzewo select jest następująca:

function showList(id) {
 $("pokaz").innerHTML='<span class="txterrb">Proszę czekać... </
span>';
  var zapytanie = "?pg=budynki&q="+id;
  alert("VALUE: " + id);
  advAJAX.get({
    url : zapytanie,
    onSuccess : function(obj) {
      $("pokaz").innerHTML=obj.responseText;
    }
  });
}

Problem pojawia się w momencie przesłania danych do funkcji
onChange="javascript:showList(this);
i odebrania ich przez skrypt ' ?pg=budynki&q="+id '

Skrypt powinien prze Get'a odebrać numer budynku
$id = $_GET['q'];

lecz niestety jak wyświetlam zawartość przesłanego pola mam
następującą wartość:
$id = [object HTMLSelectElement]

co jest dalej dla mnie nie zrozumiałe i nie wiem gdzie jest błąd...?

Może ktoś coś doradzić?
Re: Select z 2 zależnych od siebie list i bład [object HTMLSelectElement]
#49910
Author: Artur Kosmal
Date: Fri, 02 Apr 2010 20:51
7 lines
1153 bytes
Krystian pisze:

> <select id="list1" name="list1" onChange="javascript:showList(this);">

nie sprawdzalem, pisze z glowy, czyli z niczego ;p

sprobuj onChange="javascript:showList(this.value);"
Re: Select z 2 zależnych od siebie list i bład [object HTMLSelectElement]
#49911
Author: Peter May
Date: Fri, 02 Apr 2010 21:15
17 lines
1388 bytes
W dniu 2010-04-02 22:20, Krystian pisze:
> Witam,
>
> Mam problem, tworzę stronkę przy pomocy js i axjaxa i problem mam
> następujący problem:
>
> W momencie zmiany opci w 1 selectie wywołuję funkcję za pomocą:
> <select id="list1" name="list1" onChange="javascript:showList(this);">

Dałbym:

onchange="showList(this.options[this.selectedIndex].value)"

[...]

-- 
Peter
Re: Select z 2 zależnych od siebie list i bład [object HTMLSelectElement]
#49912
Author: Krystian
Date: Fri, 02 Apr 2010 23:06
24 lines
1848 bytes
On 2 Kwi, 23:15, Peter May <peter....@onet.pl> wrote:
> W dniu 2010-04-02 22:20, Krystian pisze:
>
> > Witam,
>
> > Mam problem, tworzę stronkę przy pomocy js i axjaxa i problem mam
> > następujący problem:
>
> > W momencie zmiany opci w 1 selectie wywołuję funkcję za pomocą:
> > <select id="list1" name="list1" onChange="javascript:showList(this);">
>
> Dałbym:
>
> onchange="showList(this.options[this.selectedIndex].value)"
>
> [...]
>
> --
> Peter

Dzieki Wielkie działa....


Pozdrawiam,
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads