Skip to content

Numbers

Input fields for numbers can be created using the input type number in the input element.

Example

<p>
    Enter the smallest prime number:
</p>
<p>
    Answer: <input><number>2</number></input>
</p>

Attributes

The number element supports the following attributes:

Attribute Type Default Description
base NumberBase - Base of the standard positional number system in which the number is expected from the user and written in the solution.
credits xs:nonNegativeInteger 1 Number of credit points the user gets awarded for this input value.
lowerreltolerance NonNegativeDecimal - If this value is LRT and the solution is x, then any value between x-LRT*
lowertolerance NonNegativeDecimal - If this value is LT and the solution is x, then any value between x-LT and x is considered a correct value.
maxfracdigits xs:nonNegativeInteger | Unbounded - Maximum number of fractional digits (digits after the radix point) that are allowed in the users input.
maxfracdigitshints xs:boolean - Whether or not to give live hints about the maximum number of allowed fractional digits (digits after the radix point) when the user has not yet submitted the input value.
maxintdigits xs:nonNegativeInteger | Unbounded - Maximum number of integer digits (digits before the radix point) that are allowed in the users input.
maxintdigitshints xs:boolean - Whether or not to give live hints about the maximum number of allowed integer digits (digits before the radix point) when the user has not yet submitted the input value.
minfracdigits xs:nonNegativeInteger - Minimum number of fractional digits (digits after the radix point) that have to appear in the users input.
minfracdigitshints xs:boolean - Whether or not to give live hints about the minimum number of allowed fractional digits (digits after the radix point) when the user has not yet submitted the input value.
minintdigits xs:nonNegativeInteger - Minimum number of integer digits (digits before the radix point) that have to be present in the users input.
minintdigitshints xs:boolean - Whether or not to give live hints about the minimum number of allowed integer digits (digits before the radix point) when the user has not yet submitted the input value.
model xs:Name - Name of the model to use for this input value. If this attribute is not set, the input model associated to the input field containing this input value is used.
significancecheck SignificanceCheckMode - Controls whether, when the significant attribute is set to a value different to none, trailing zeros in whole numbers in the user input should be counted as significant whenever this makes the input correct (lax mode) or not (strict mode).
significant xs:positiveInteger | None - When set to a value different to none, this attribute defines the number of significant digits that are expected from the user in order for the input to be correct. The significant digits are counted from left to right. The treatment of trailing zeros in whole numbers in the user input can be controlled with the signifciancecheck attribute.
upperreltolerance NonNegativeDecimal - If this value is URT and the solution is x, then any value between x and x+URT*
uppertolerance NonNegativeDecimal - If this value is UT and the solution is x, then any value between x and x+UT is considered a correct value.