Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [advAjax] button a onsubmit
barts
post
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 8.07.2005

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


Przeczytalem artykul http://wortal.php.pl/phppl/wortal/artykuly...aca_technologia

i wlasnie taka funkcjonalnosc na stronie chcialbym osiagnac. Zauwazylem jeden blad w:

<button onClick="sprawdz_dane();">Zarejestruj mnie...</button>

musi byc jeszcze return false;

<button onClick="sprawdz_dane(); return false;">

bo wczesniej na firefoxie nie chcialo dzialac sprawdzenie w Ajaxie tylko od razu wysylalo formularz. Tylko teraz problem jest pod IE, bo jak nacisne enter po wypelnieniu formularza to jest wysylany od razu bez sprawdzenia (sprawdz_dane). W IE trzeba nacisnac button zeby bylo sprawdzenie poprawnosci. Jak mozna to obejsc? Chcialbym zeby zarowno w IE jak i w firefoxie po nacisnieciu entera jak i nacisnieciu buttona sprawdzalo dane. Wiem, ze mozna zrobic <form onsubmit="sprawdz_dane()..."> ale wtedy nie wiem co dac w pliku example.js, bo:

  1. if(obj.responseText == "OK") {
  2. $("registerForm").submit();
  3. }


nie dziala.
Go to the top of the page
+Quote Post
lukaszchm
post
Post #2





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 8.07.2006

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


a czym sie objawia nie działanie?
nie przesyła sie formularz? nie wchodzi do tej selekcji? a może cała ta funkcja sie nie wykonuje?
Go to the top of the page
+Quote Post
barts
post
Post #3





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 8.07.2005

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


Kiedy jest button, ktory trzeba przycisnac i w IE nacisne enter zeby wyslac formularz (jak wiekszosc userow) zamiast nacisnac button to wysyla sie formularz do register3.php, bez przejscia procesu sprawdzenia zmiennych, ktore sprawdza register2.php za pomoca AJAXa. Dopiero kiedy klikne w button to zmienne z formularza sa sprawdzane.
Go to the top of the page
+Quote Post
lukaszchm
post
Post #4





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 8.07.2006

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


no a jak a dodasz obsługę zdarzenia onsubmit do formularza? co wtedy nie działa?
Go to the top of the page
+Quote Post
barts
post
Post #5





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 8.07.2005

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


Błąd: $("registerForm").submit is not a function
Plik źródłowy: http://localhost/barts/examples.js
Wiersz: 17
Go to the top of the page
+Quote Post
lukaszchm
post
Post #6





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 8.07.2006

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


404

Ten post edytował lukaszchm 8.07.2006, 17:01:14
Go to the top of the page
+Quote Post
barts
post
Post #7





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 8.07.2005

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


Sorry ale nie zrozumielem Co masz na mysli wpisujac 404. Ze rozwiazanie nie istnieje? (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Zrobilem: <form onsubmit="return false"> i w ten sposob w Firefoxie po wypelnieniu formularza i kliknieciu w button albo nacisnieciu entera wszystko jest ok, natomiast w IE enter nie dziala (nie wysyla formularza) i trzeba kliknac w button zeby formularz sie sprawdzil i wyslal. Ma ktos inne pomysly na rozwiazanie tego?

Ten post edytował barts 8.07.2006, 18:40:41
Go to the top of the page
+Quote Post
angel2953
post
Post #8





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

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


spróbuj dla tego przycisku ustawić accesskey na [Enter] to powinno pomóc...
Go to the top of the page
+Quote Post
lukaszchm
post
Post #9





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 8.07.2006

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


Cytat(barts @ 8.07.2006, 17:50 ) *
Błąd: $("registerForm").submit is not a function
Plik źródłowy: http://localhost/barts/examples.js
Wiersz: 17

link mi sie nie otwiera

a wedłóg mnie to powinno działać i być może jest jakiś mały bug
Go to the top of the page
+Quote Post
kwiateusz
post
Post #10


Admin Techniczny


Grupa: Administratorzy
Postów: 2 072
Pomógł: 93
Dołączył: 5.07.2005
Skąd: Olsztyn




$() zapewne musialbys zamienic na document.getElementById (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
barts
post
Post #11





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 8.07.2005

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


Zmiana na document.getElementById tez nic nie daje.

<button accesskey="enter"> nie dziala.
Go to the top of the page
+Quote Post
lukaszchm
post
Post #12





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 8.07.2006

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


ale jakiś błąd? moze obiekt nie obsługuje tej własności lub metody? wyalertuj $(....) zobaczysz czy znalazł referencje do obiektu
trzeba coś kombinować
Go to the top of the page
+Quote Post

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: 21.09.2025 - 18:02