Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> POST nie działa
xlinksysx
post 1.11.2009, 16:44:47
Post #1





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 18.05.2009

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


Dlaczego nie przesyła mi danych POST'em? Mam taki kod:

  1. <form action="" method="POST" id="LoginForm">
  2. <div>
  3. <input type="text" name="user" class="input1"><input type="password" name="password" class="input2">
  4. <a href="" class="link" onclick="document.getElementById("LoginForm").submit()"><span><span>Zaloguj się</span></span></a>
  5. </div>
  6. </form>


Wiem, że wina leży w submicie - jak zrobić, aby link był submitem?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 13)
vokiel
post 1.11.2009, 17:07:50
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Użyć input type="submit"
Użyć poprawnego wywołania submit na formularzu w js:
[JAVASCRIPT] pobierz, plaintext
  1. document.forms[0].submit()
[JAVASCRIPT] pobierz, plaintext


--------------------
Go to the top of the page
+Quote Post
xlinksysx
post 1.11.2009, 17:35:17
Post #3





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 18.05.2009

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


Mógłbyś dać przykład jest użyć: document.forms[0].submit()? Nie znam się na JavaScripcie. Próbowałem:

  1. <a href="" class="link" onclick="document.LoginForm.submit()">


LoginForm - nazwa forma

no i nie działa.
Go to the top of the page
+Quote Post
vokiel
post 1.11.2009, 17:50:55
Post #4





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


To może spróbuj, no nie wiem:
  1. <a href="" class="link" onclick="document.forms[0].submit()">


--------------------
Go to the top of the page
+Quote Post
piotrooo89
post 1.11.2009, 18:00:57
Post #5


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




a może tak:

  1. <a href="" class="link" onclick="this.form.submit();">Wyślij</a>


--------------------
Go to the top of the page
+Quote Post
Quantum
post 1.11.2009, 18:41:10
Post #6





Grupa: Zarejestrowani
Postów: 450
Pomógł: 84
Dołączył: 27.11.2008
Skąd: Warszawa

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


  1. <form action="" method="POST" id="LoginForm">


Cytat(xlinksysx)
LoginForm - nazwa forma


id - identyfikator,
name - nazwa.

zmień na
  1. <form action="" method="POST" name="LoginForm">


i wysyłasz :

  1. <a href="" class="link" onclick="document.LoginForm.submit()">
Go to the top of the page
+Quote Post
xlinksysx
post 1.11.2009, 20:15:55
Post #7





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 18.05.2009

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


Niestety żaden z podanych sposobów nie działa.
Go to the top of the page
+Quote Post
seth-kk
post 1.11.2009, 20:21:39
Post #8





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

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


Twoj kawalek
  1. <a href="" class="link" onclick="document.getElementById("LoginForm").submit()">

Moj kawalek
  1. <a href="" class="link" onclick="document.getElementById('LoginForm').submit(); return false;">

znajdz 2 roznice


--------------------
Go to the top of the page
+Quote Post
xlinksysx
post 1.11.2009, 20:40:01
Post #9





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 18.05.2009

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


Nie działa. mellow.gif
Go to the top of the page
+Quote Post
seth-kk
post 1.11.2009, 20:53:02
Post #10





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

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


Cytat(xlinksysx @ 1.11.2009, 21:40:01 ) *
Nie działa. mellow.gif

A moze troche precyzyjniej?
Jesli dokument sie nie waliduje lub konsola javascript sypie bledami - poprawic a nastepnie przedstawic objawy


--------------------
Go to the top of the page
+Quote Post
piotrooo89
post 1.11.2009, 21:04:33
Post #11


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




na 100% działa właśnie sprawdzałem:

  1. <form action="" method="get" id="LoginForm">
  2.  
  3. <input type="text" name="user" class="input1">
  4. <input type="password" name="password" class="input2">
  5.  
  6. <a href="" class="link" onclick="document.getElementById('LoginForm').submit(); return false;">Zaloguj się</a>
  7. </form>


--------------------
Go to the top of the page
+Quote Post
xlinksysx
post 1.11.2009, 21:13:06
Post #12





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 18.05.2009

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


Wiem w czym był problem....

  1. onclick="document.getElementById('LoginForm').submit(); return false;"


LoginForm brałem w cudzysłów, bo wcześniej mam:

  1. echo 'tutaj ten formularz';


Jak zrobić, żebym mógł wziąść to między echo?
Go to the top of the page
+Quote Post
Wicepsik
post 1.11.2009, 21:18:20
Post #13





Grupa: Zarejestrowani
Postów: 1 575
Pomógł: 299
Dołączył: 26.03.2009

Ostrzeżenie: (20%)
X----


  1. echo 'onclick="document.getElementById(\'LoginForm\').submit(); return false;"';


Ten post edytował Wicepsik 1.11.2009, 21:18:37


--------------------
Go to the top of the page
+Quote Post
piotrooo89
post 1.11.2009, 21:21:08
Post #14


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




@xlinksysx podajesz niekompletny kod i się dziwisz że nikt nie jest w stanie Ci pomóc... szanujmy swój czas... jak chcesz uzyskać pomoc musisz przedstawić cały problem a nie tylko jego część.


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 17:07