-
Path: news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!newsfeed.neostrada.pl!a
tlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail
From: "Gabriel" <z...@p...fm>
Newsgroups: pl.comp.www
Subject: Re: Sprawdzanie poprawności formularzy
Date: Fri, 23 Jan 2009 23:32:59 +0100
Organization: TP - http://www.tp.pl/
Lines: 86
Message-ID: <gldgko$arj$1@atlantis.news.neostrada.pl>
References: <gklg7e$kg$1@nemesis.news.neostrada.pl><2...@p...p
lace.you.dont.want.to.be><gkmipk$gdq$1@atlantis.news.neostrada.pl><gladgn
$nis$1@atlantis.news.neostrada.pl><2...@p...place.
you.dont.want.to.be><glalv0$707$1@nemesis.news.neostrada.pl><200901222230
29.55b0b734@pingwin.place.you.dont.want.to.be><op.un7ansyz3rqv00@milenijn
a.lebkowski.info>
<2...@p...place.you.dont.want.to.be>
NNTP-Posting-Host: acjv28.neoplus.adsl.tpnet.pl
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Trace: atlantis.news.neostrada.pl 1232750040 11123 83.10.71.28 (23 Jan 2009
22:34:00 GMT)
X-Complaints-To: u...@n...neostrada.pl
NNTP-Posting-Date: Fri, 23 Jan 2009 22:34:00 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Xref: news-archive.icm.edu.pl pl.comp.www:390277
[ ukryj nagłówki ]
Użytkownik "Mirosław Zalewski" <miniopl@CUT_THIS.gmail.com> napisał w
wiadomości news:20090123223541.32bf8ba0@pingwin.place.you.dont.
want.to.be...
A to przerobiony nieco kod PPK (z uwzglednieniem tej naszej dyskusji):
var W3CDOM = (document.getElementsByTagName && document.createElement);
function validate() {
validForm = true;
firstError = null;
errorstring = '';
var x = document.forms[0].elements;
for (var i=0;i<x.length;i++) {
if
((!x[i].value)&&(x[i].nodeName.toUpperCase()!="FIELD
SET")&&(x[i].type.toUppe
rCase()!="HIDDEN")&&(x[i].type.toUpperCase()!="SUBMI
T"))
writeError(x[i],'To pole jest wymagane');
}
if (x['email'].value.indexOf('@') == -1)
{
writeError(x['email'],'Podaj poprawny adres email');
return false;
}
if (!W3CDOM)
{
return true;
}
if (firstError)
{
firstError.focus();
}
if (validForm)
{
return true;
}
return validForm;
}
function writeError(obj,message) {
validForm = false;
if (obj.hasError) return;
if (W3CDOM) {
obj.className += ' error';
obj.onchange = removeError;
var sp = document.createElement('span');
sp.className = 'error';
sp.appendChild(document.createTextNode(message));
obj.parentNode.appendChild(sp);
obj.hasError = sp;
}
else {
errorstring += obj.name + ': ' + message + '\n';
obj.hasError = true;
}
if (!firstError)
firstError = obj;
}
function removeError()
{
this.className = this.className.substring(0,this.className.lastIndexO
f('
'));
this.parentNode.removeChild(this.hasError);
this.hasError = null;
this.onchange = null;
}
Wywolywany jest w formularzu poprzez onsubmit="return validate();"
Gdyby ktos mial jakies uwagi, to smialo:)
--
Pozdrawiam
Gabriel Zastawnik
http://www.sigsoft.pl - Monitoring Komputera
Następne wpisy z tego wątku
- 24.01.09 09:48 Gabriel
- 24.01.09 09:58 Paweł Piskorz
- 24.01.09 10:07 Gabriel
- 24.01.09 11:44 ethanak
- 24.01.09 11:59 Radek N.
- 24.01.09 12:18 ethanak
- 24.01.09 12:28 Radek N.
- 24.01.09 13:04 Gabriel
- 24.01.09 13:06 Gabriel
- 24.01.09 14:25 ethanak
- 24.01.09 14:37 Radek N.
- 24.01.09 16:56 Grzegorz Staniak
- 24.01.09 17:10 ethanak
- 24.01.09 17:12 Radek N.
- 24.01.09 22:05 Grzegorz Staniak
Najnowsze wątki z tej grupy
- Jakie znacie działające serwery grup dyskusyjnych?
- is it live this group at news.icm.edu.pl
- php, linki z nazwami a $_GET, SEO
- www polityka pl captcha
- dyktatura brudnego palucha
- www.znanylekarz.pl
- Czy pytanie o sczytywanie stron programami/skryptami to tu?
- Grupy webdevowe
- Jak wydrukować stronę?
- IIS, kilka witryn
- linki <a href="/strona.php"> (ze slashami)
- co rozszerza stronę??
- responsywny akapit <p>
- Czy istnieje jakiś emulator przeglądarek pod Mac'a?
- taka sama konfiguracja dla localhost i produkcji
Najnowsze wątki
- 2024-09-16 zapora Stronie Slaskie
- 2024-09-16 powodz
- 2024-09-16 Aple ma przycisk APARATU. SERIO? Tyle lat im to zajęło?
- 2024-09-15 Mulitisim
- 2024-09-15 Jaki telefon dla "SENIORA"? ;-)
- 2024-09-18 Co z 7 miejsc w leasingu dla fizycznych?
- 2024-09-17 Kultura zapie....ania
- 2024-09-17 Gdańsk się skończył dla mnie.
- 2024-09-16 Elektryki z południa lecą do ciepłych krajów :)
- 2024-09-16 Re: Wolkswagen szantażuje rząd aby powróciły dotacje do elektryków
- 2024-09-17 Wybuchające pagery
- 2024-09-18 szukam speca od mini-remontow (w w-wie)
- 2024-09-18 Warszawa => Spedytor międzynarodowy <=
- 2024-09-18 Kraków => Java Full Stack Developer (Angular/React) <=
- 2024-09-18 Warszawa => Projektant/Programista React Native <=