![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 198 Pomógł: 0 Dołączył: 31.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witam mam skrypt do wysylania formularza kontaktowego gdzie walidacja jest w js i nastepnie w php. Jak po walidacji w js wyslac maila?
Kod <script LANGUAGE = JavaScript> function process(){ var name = document.getElementById('name').value; var reg= /^[a-zA-Z0-9]{1,10}$/; sprawdz= document.getElementById('name').value.match(reg); var email = document.getElementById('email').value; var remail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; semail= document.getElementById('email').value.match(remail); if(!name || !sprawdz ) { document.getElementById('eror_name').innerHTML = '<font color="red">Bład</font>';} if(email < 6 || !semail ) { document.getElementById('eror_email').innerHTML = '<font color="red">Bład email</font>';} else { document.getElementById('eror_name').innerHTML = ''; document.getElementById('eror_email').innerHTML = ''; } } /* nie wiem co tutaj powino byc*/ </script> <form action="#" method="POST" name="formularz"> <legend align="center"></legend> <br /> Imie nazwisko(Nazwa)<input name="name" id="name" type="text"> <span id="eror_name"></span> <br/> <br/> email<input type="text" name="email" id="email" value=""> <span id="eror_email"></span> <br/><br/> tresc<textarea name="tresc" style="width: 250px; height: 100px"></textarea><br/><br/> <input type="button" name="wyslij" value="Wyslij" onclick="process()"></form> Co powinienem teraz zrobic? |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 4 655 Pomógł: 556 Dołączył: 17.03.2009 Skąd: Katowice Ostrzeżenie: (0%) ![]() ![]() |
Zamiast:
<input type="button" name="wyslij" value="Wyslij" onclick="process()"></form> W znaczniku forum dodaj onsubmit i tam wykonaj process() I po sprawdzeniu zwróć true or false i albo przejdzie do skryptu podanego w action albo nie ;p (zależnie od walidacji formularza) -------------------- Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP |
|
|
![]()
Post
#3
|
|
![]() Grupa: Zarejestrowani Postów: 313 Pomógł: 24 Dołączył: 9.08.2008 Skąd: Kielce Ostrzeżenie: (0%) ![]() ![]() |
dokładniej to ma być coś takiego
Ten post edytował pgrzelka 17.07.2009, 00:58:57 -------------------- |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 4 655 Pomógł: 556 Dołączył: 17.03.2009 Skąd: Katowice Ostrzeżenie: (0%) ![]() ![]() |
dokładniej to ma być coś takiego
action też trzeba dodać, w dodatku process musi zwracać true or false i będzie śmigało. -------------------- Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 04:30 |