Jump to content


Photo

Need help looping through form input fields


  • Please log in to reply
2 replies to this topic

#1 Lee W

Lee W

    Dedicated Member

  • Members
  • PipPip
  • 117 posts
  • Gender:Male
  • Location:Manchester
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 11 April 2012 - 07:32 AM

Good morning,

I have a small problem that's driving me nuts because i'm pretty new to Javascript.

I want to loop through a selected number of inputfields in a form which all have a class of 'quantity'.

When an 'onblur' event happens on each particular input field i want it to display whether the input was a valid number or not next to the field in a span class.

Any idea's or solutions would be appreciated.

Regards,
Lee.


#2 user-removed

user-removed

    Forum Newcomer

  • Validating
  • Pip
  • 0 posts
  • Gender:Not Telling
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 11 April 2012 - 08:06 AM

Good morning,

I have a small problem that's driving me nuts because i'm pretty new to Javascript.

I want to loop through a selected number of inputfields in a form which all have a class of 'quantity'.

When an 'onblur' event happens on each particular input field i want it to display whether the input was a valid number or not next to the field in a span class.

Any idea's or solutions would be appreciated.

Regards,
Lee.



It sounds to me like you're looking for a validation plugin. This one I use and should do the trick. As far as I'm aware though, it loops by the name tag, not the class tag, but you could still use it.

http://bassistance.d...gin-validation/


#3 Lee W

Lee W

    Dedicated Member

  • Members
  • PipPip
  • 117 posts
  • Gender:Male
  • Location:Manchester
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 11 April 2012 - 08:27 AM

That's great Mike thanks very much but i would be interested to know the Javascript way because the reason i am developing this form is to sharpen up my javascript & to gain a better understanding of it.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users