void onValidateFromQuestionForm() throws ValidationException { if (next) { if (selAnswer == null) { throw new ValidationException(messages.format("invalid-selected")); } if (selAnswer.equals("Y")) { if (orderNumber == null || orderNumber.equals("")) { throw new ValidationException(messages.format("order-number-empty")); } int orderNum = -1; try { orderNum = Integer.valueOf(orderNumber); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("invalid-order-number")); } boolean orderExisted = false; try { orderExisted = service.checkCustomerOrderExisted(orderNum); } catch (RemoteException e) { } if (!orderExisted) { throw new ValidationException(messages.format("order-not-existed")); } } else if (selAnswer.equals("N")) { if (explainwhy == null) { throw new ValidationException(messages.format("invalid-exlain-q2")); } } } }
@Override protected void processSubmission(String elementName) { String value = request.getParameter(elementName); tracker.recordInput(this, value); updateClientTimeZone(elementName); Date parsedValue = null; try { if (InternalUtils.isNonBlank(value)) { // Regardless of the timeZone set on the DateFormat, the value is parsed in // the current default TimeZone. Use the calendar to adjust it out. Date inDefaultTimeZone = format.parse(value); parsedValue = convertDateToClientTimeZone(inDefaultTimeZone); } } catch (ParseException ex) { tracker.recordError(this, messages.format("tapx-date-value-not-parseable", value)); return; } try { fieldValidationSupport.validate(parsedValue, resources, validate); } catch (ValidationException ex) { tracker.recordError(this, ex.getMessage()); return; } if (min != null && parsedValue.before(min)) { tracker.recordError(this, messages.get("tapx-date-value-to-early")); return; } if (max != null && parsedValue.after(max)) { tracker.recordError(this, messages.get("tapx-date-value-too-late")); return; } this.value = parsedValue; }