Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes validations coding.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "validations coding.." Watch "validations coding.." New topic
Author

validations coding..

may tan
Greenhorn

Joined: Jul 22, 2005
Posts: 22
hello..

i'm not sure on how to add in a "POP-UP" menu when user forget to enter all textfields..

For eg: there are 3 required text field for user to key in but user only key in 2 text field..

so i want a pop-up menu to inform user to enter all text field...
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
There are several ways; here is a relatively easy one. It will check that the input is not empty but will not verify that the input meets any particular requirements. Assuming you have three text fields called nameField, ageField, and addressField, just do something like this:

You could also check the name, age, and address separately using three if statements and then have specific messages such as "The name must be filled", etc.
may tan
Greenhorn

Joined: Jul 22, 2005
Posts: 22
hmm.. ok..

but under which public void shd i add the coding given?

also does e following coding applies to applet??
JOptionPane.showMessageDialog(null, "All fields must be filled");

or do i need to change "JOptionPane"?

Thanks for your info by the way =)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: validations coding..