Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28751 > unrolled thread

Javascript Form Validation

Started byabdullahh546@gmail.com
First post2015-09-28 13:07 -0700
Last post2015-09-29 12:10 +0200
Articles 5 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

#28751 — Javascript Form Validation

Fromabdullahh546@gmail.com
Date2015-09-28 13:07 -0700
SubjectJavascript Form Validation
Message-ID<29b8982c-33e2-4567-9c8a-fe328381dda1@googlegroups.com>
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 .

[toc] | [next] | [standalone]


#28752

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-09-28 23:44 +0200
Message-ID<XnsA523F16F5D36Eeejj99@194.109.6.166>
In reply to#28751
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?

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#28755

FromAbdullah hasan <abdullahh546@gmail.com>
Date2015-09-29 01:19 -0700
Message-ID<0a9b1bf5-cf7d-4ebc-8bc7-a7b66effdfa0@googlegroups.com>
In reply to#28752
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?
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

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 .

[toc] | [prev] | [next] | [standalone]


#28756

FromAbdullah hasan <abdullahh546@gmail.com>
Date2015-09-29 01:20 -0700
Message-ID<ec7f42a5-14a6-4989-891f-e20f8be8fa1a@googlegroups.com>
In reply to#28755
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?
> > 
> > -- 
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
> 
> 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;

      }

    }

[toc] | [prev] | [next] | [standalone]


#28757

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-09-29 12:10 +0200
Message-ID<XnsA5247BE4CCD0Ceejj99@194.109.6.166>
In reply to#28756
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)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web