File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java SE 6 validating Required data elements Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Java SE 6 validating Required data elements" Watch "Java SE 6 validating Required data elements" New topic
Author

Java SE 6 validating Required data elements

duane skey
Greenhorn

Joined: Jun 16, 2009
Posts: 3
I need help Validating the required data elements in this program. I need the Patient id,Patient last name Patient first name, Patient primary care physician, Patient address1,Patient city, Patient State, Patient zip. all validated (entered as non-spaces) If invalid data is ,entered, display an "invalid input of type .. Record reject" message and use the COUNTINUE statement to return to the top of the loop to allow a new entry to be made.

Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

"coach win", please check your private messages for an important administrative matter.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

Please Use Code Tags. You can edit your post to add them.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

Check out Scanner's other methods, like nextInt(). Also, use the hasNextXXX methods to check if data is available. For instance:
To make sure your code remains readable, you can create one method for each different type of validation.
duane skey
Greenhorn

Joined: Jun 16, 2009
Posts: 3
inserted the code into the program and this is the error
recieved this Error on This line
if (id == null || <id is invalid>);
Multiple markers at this line

- Syntax error on token "is", , expected
- String literal is not properly closed by a
double-quote
- Syntax error on token(s), misplaced construct
(s)
- Syntax error on tokens, delete these tokens
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

The <id is invalid> is pseudo code. You should fill that in yourself, based on the logic of when an ID is invalid. As I said, you could create a method "boolean isValidPatientID(String id)", then change the if to
 
IntelliJ Java IDE
 
subject: Java SE 6 validating Required data elements
 
Threads others viewed
org.apache.jasper.JasperException: java.lang.NullPointerException: Module 'null' not found.
Problem - how to ask for date of birth
type of argument lost?
IF statement error help Running short on time.
Updating a form in primefaces when a selection is made in the datatable
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com