Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28757
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Javascript Form Validation |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <29b8982c-33e2-4567-9c8a-fe328381dda1@googlegroups.com> <XnsA523F16F5D36Eeejj99@194.109.6.166> <0a9b1bf5-cf7d-4ebc-8bc7-a7b66effdfa0@googlegroups.com> <ec7f42a5-14a6-4989-891f-e20f8be8fa1a@googlegroups.com> |
| Date | 2015-09-29 12:10 +0200 |
| Message-ID | <XnsA5247BE4CCD0Ceejj99@194.109.6.166> (permalink) |
Abdullah hasan <abdullahh546@gmail.com> wrote on 29 Sep 2015 in
comp.lang.javascript:
> On Tuesday, September 29, 2015 at 4:19:41 PM UTC+8, Abdullah hasan
> wrote:
>> On Tuesday, September 29, 2015 at 5:44:14 AM UTC+8, Evertjan. wrote:
>> > abdullahh546@gmail.com wrote on 28 Sep 2015 in comp.lang.javascript:
>> >
>> > > I am creating a Registration/login page . When user enter a field ,
>> > > and goes no to next field , i want the browser to show the error
>> > > just below the incorrect data field . In this way only valid
>> > > entries is submitted . I dont want to show error when user click
>> > > submit button . Just after every wrong field when going to next
>> > > field .
>> >
>> > Have you got a question?
>> >
>> > Is this a school assignment?
[please do not quote signatures on usenet]
>> No assignment . Just experimenting . I can easily show the error(if
>> any) below the field when user hit submit button . But what i want is
>> to show error immediately after going to next field .
>
> function myfunction() {
> var v = document.getElementById('email').value;
> if(v=="") {
> document.getElementById('colour1').className+=' has-error';
> document.getElementById('fill').innerHTML =
> 'Please enter a valid username';
> return false;
Not needed for below.
> };
> };
[Still my first Q is not anwered, I'll have to guess]
use:
<input onBlur = 'myfunction(this)' ...>
For multiple fields getElementById() will not be ideal,
try DOM-transversing with:
'this', 'parentNode', etc.
and display:none or visibility:hidden.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Javascript Form Validation abdullahh546@gmail.com - 2015-09-28 13:07 -0700
Re: Javascript Form Validation "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-28 23:44 +0200
Re: Javascript Form Validation Abdullah hasan <abdullahh546@gmail.com> - 2015-09-29 01:19 -0700
Re: Javascript Form Validation Abdullah hasan <abdullahh546@gmail.com> - 2015-09-29 01:20 -0700
Re: Javascript Form Validation "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-29 12:10 +0200
csiph-web