File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes text field validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "text field validations" Watch "text field validations" New topic

text field validations

neeha sharma

Joined: Jun 12, 2009
Posts: 11
hai my dear friends

i got a task recently which contains 25 text fields and no field have same value.
please tell me the best and efficient way to validate this problem.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

It sonds like you want to check none of the 25 fields contain a duplicate value. Do you want to do this in Java or JavaScript? In Java, you could put all the values in a HashSet and see that the size is 25 since the HashSet will remove all duplicates. In JavaScript, I think you'd need to write a loop.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Srikanth Nakka

Joined: Apr 15, 2007
Posts: 26

if it is on web page you can easily done by javaScript

Thanking You,
Srikanth Nakka
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Srikanth Nakka wrote:if it is on web page you can easily done by javaScript

why not in java ? Jeanne Boyarsky mentioned already
David Newton

Joined: Sep 29, 2008
Posts: 12617

Without knowing anything about your environment, whether you want to do it in JavaScript or Java, it's difficult to provide helpful input.

Are they all named the same thing? Are they indexed? Java or JavaScript? Back-end framework or plain old servlets?
neeha sharma

Joined: Jun 12, 2009
Posts: 11
i want to do it in java script
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Moved to the HTML/JavaScript forum.

[Asking smart questions] [About Bear] [Books by Bear]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Read a form field

I hope you can figure out the rest from there.

I agree. Here's the link:
subject: text field validations
It's not a secret anymore!