mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-09 05:48:20 +00:00
Fixed 'step' attribute value for integer fields; Fixed handling of NumberFormatException
This commit is contained in:
parent
9b316a3ad1
commit
c205e4948c
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -56,7 +56,7 @@
|
||||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
|
||||
|
||||
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
|
||||
step="any"
|
||||
th:step="${field.getStep()}"
|
||||
></input>
|
||||
</div>
|
||||
</th:block>
|
||||
|
Loading…
x
Reference in New Issue
Block a user