• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Checking value of one textfield matching the other

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to come up with a password change function. This is how it should work

1 textfield : enter new passowrd
2 textfield : enter same password

If the value from both the textfield match, then update the database. I do know how to do the updating and retriving part. Need help on how to compare both textfields and to provide a pop up if they dont match.
 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vanan saravanan:
I'm trying to come up with a password change function. This is how it should work

1 textfield : enter new passowrd
2 textfield : enter same password

If the value from both the textfield match, then update the database. I do know how to do the updating and retriving part. Need help on how to compare both textfields and to provide a pop up if they dont match.



I think, Javascript would be better for this kind of validation but do it on server side also.

Getting value of textfield in JS:
var value = document.getElementById("id_of_textfield").value;

Now it's your job.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The general guideline is, always use javascript to validate really simple logic but also always validate any input to the middle tier. This may mean validation gets checked at 3 levels (javascript/servlet/database) but its not pointless since your inputs may not come from the same places all the time and the systems need to protect themselves and their data.
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Scott, what do you meen by servlet validation?

Cheers
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marko Debac:
Hello,

Scott, what do you meen by servlet validation?

Cheers



What he means is that it's important to validate input on the servers side (even if you're also doing so with Javascript on the client).
 
This tiny ad is suggesting that maybe she should go play in traffic.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic