Fixed 'step' attribute value for integer fields; Fixed handling of NumberFormatException

This commit is contained in:
Francesco 2023-10-27 12:03:44 +02:00
parent 9b316a3ad1
commit c205e4948c
3 changed files with 18 additions and 2 deletions

View File

@ -417,7 +417,7 @@ public class DbObjectSchema {
return dbObject;
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e);
throw new DbAdminException(e);
}
}

View File

@ -190,6 +190,22 @@ public class DbField {
return type instanceof TextFieldType;
}
/**
* Returns the value to use in the "step" HTML attribute
* for numeric data fields. For fields that are not numeric,
* we just return the String "any", as it is not included
* in the HTML template anyway.
* @return
*/
public String getStep() {
if (getType() instanceof IntegerFieldType
|| getType() instanceof BigIntegerFieldType
|| getType() instanceof ByteFieldType) {
return "0";
}
return "any";
}
/**
* Returns the name of the Thymeleaf fragment used to render
* the input for this field.

View File

@ -56,7 +56,7 @@
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any"
th:step="${field.getStep()}"
></input>
</div>
</th:block>