Esempio n. 1
0
  @Override
  public FormRowSet formatData(FormData formData) {
    FormRowSet rowSet = null;

    // get value
    String id = getPropertyString(FormUtil.PROPERTY_ID);
    if (id != null) {
      String[] values = FormUtil.getElementPropertyValues(this, formData);
      if (values != null && values.length > 0) {
        // check for empty submission via parameter
        String[] paramValues = FormUtil.getRequestParameterValues(this, formData);
        if ((paramValues == null || paramValues.length == 0)
            && FormUtil.isFormSubmitted(this, formData)) {
          values = new String[] {""};
        }

        // formulate values
        String delimitedValue = FormUtil.generateElementPropertyValues(values);

        // set value into Properties and FormRowSet object
        FormRow result = new FormRow();
        result.setProperty(id, delimitedValue);
        rowSet = new FormRowSet();
        rowSet.add(result);
      }
    }

    return rowSet;
  }
Esempio n. 2
0
 @Override
 public FormData formatDataForValidation(FormData formData) {
   String[] paramValues = FormUtil.getRequestParameterValues(this, formData);
   if ((paramValues == null || paramValues.length == 0)
       && FormUtil.isFormSubmitted(this, formData)) {
     String paramName = FormUtil.getElementParameterName(this);
     formData.addRequestParameterValues(paramName, new String[] {""});
   }
   return formData;
 }