Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
Unknown
-
Description
Macro parameters of a numeric type, such as int, long, float or double, are displayed in the Edit Macro dialog as a plain text input. Any value is accepted, including letters, and the dialog submits it. The user only finds out the value is invalid when the macro is rendered with an error.
There is no HTML displayer for numeric types, so they fall back to html_displayer/default.vm, which outputs an <input type="text">. The dialog's validation only checks that mandatory parameters are not empty.
Steps to reproduce
- Edit a page with the WYSIWYG editor.
- Insert the Table of Contents macro.
- Type abc in the start parameter and submit.
Expected
The field only accepts numbers. An invalid value is flagged next to the field and the dialog does not submit until it is fixed.
Actual
The dialog submits, and the macro renders an error.
Proposal
- Add HTML displayer edit templates for the numeric types that output an <input type="number">, with a step allowing decimals for the floating point types.
- Make the Edit Macro dialog run the browser validation of its inputs before submitting, and flag the invalid field the same way an empty mandatory field is flagged.
Attachments
Issue Links
- relates to
-
XWIKI-25183 Allow the page and attachment pickers to reject references to entities that don't exist
-
- Open
-
-
XWIKI-25197 Allow wiki macro parameters to declare a range or a format for their value
-
- Open
-