[com_fields] Changing text type to number type #15020
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new
maxlength
field parameter introduced in #14458 is using a text type, therefore it does not validate when saving.It concerns text and textarea custom fields plugins
If someone enters some text i.e. "something" it is changed to
0
on save.Summary of Changes
Changed to
type="number"
Testing Instructions
Use staging. Patch.
After patch one will get:
If someone saves with some alpha string ("something", the field will be saved empty in the database instead of
0
In any case the Tip is really incomplete (not changed in this PR yet).
We have multiple cases:
1.
No value is set in the plugin params
No value is set for the field.
Result => No limit
0 is chosen in the plugin params
No value is set for the field.
Result => No limit
A value is set in the plugin params
No value is set for the field.
Result => The limit is the one set in the plugin params
Any value is set in the field.
Result => The limit is the one set in the field
If value is 0 => No limit.
Therefore we may need a specific tip for the plugin and another one for the field where some of this is explained as what we have now is only:
"The maximum number of characters that can be entered."
We could use for the plugin the existing constant
PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_DESC
and for the field
PLG_FIELDS_TEXT_FIELD_PARAMS_MAXLENGTH_DESC
@brianteeman
Any idea to make these tips informative enough?
@laoneo @Bakual