Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Object readField (String name) {
- Object o = null;
- Object[] fieldsArray;
- Field f = null;
- input = form.readString(name);
- form.writeString(name,input);
- try {
- fieldsArray = fields.toArray();
- for(int i = 0; i < fieldsArray.length; i++) {
- if(((Field)fieldsArray[i]).fieldName.compareTo(name) == 0) {
- f = (Field)fieldsArray[i];
- break;
- }
- }
- o = f.format.parseObject(input);
- try {form.writeString(name + "Error","");} // If a data check failed for this field previously, make the error message disappear.
- catch(Exception ComponentNotFoundException) {} // If not, catch the exception and move on.
- }
- catch(Exception ParseException) {
- try {form.writeString(name + "Error","Bad format, please re-enter.");} // If no previous errors, create new error message.
- catch(Exception ComponentNotFoundException) {form.addLabel(name + "Error","Bad format, please re-enter.",form.getX(name),form.getY(name)+25);} // Otherwise, update the old error message.
- }
- return o;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement