You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A certain class of errors surface when a form field string value has leading or trailing whitespace (or both) or is the empty string. It would be ideal if the spec allowed content authors to eliminate these problems and even take a default position to do so.
This issue is a proposal to add a form field member named trim that is a string that may have one of 5 possible values: leading, trailingboth, tonull and none with the following semantics:
leading: remove any leading whitespace in the field value before further evaluation
trailing: remove any trailing whitespace in the field value before further evaluation
both: remove any leading and trailing whitespace in the field value before further evaluation.
tonull: remove any leading and trailing whitespace. If the resulting string is the empty string, replace the value with null.
none: don't modify the field value string at all before further evaluation.
This field MUST be evaluated before evaluating the value against any potentially specified pattern field.
This field would only be evaluated if the field type is string or a string derivative type (like date, time, duration, etc).
If the field type is string (or a derived string type), and a trim member is not defined, then Ion parsers MUST assume a behavior of trim equal to tonull. This default is chosen as it is assumed that the majority of data processing systems do not want any leading or trailing white space or the empty string for data.
Is this a welcome addition? A negative one? Thoughts and opinions welcome.
I suppose the field MUST be evaluated before maxlength and minlength too? And if any other string validations will be introduced in the future they will always be applied after trim.
What about options?
"When an options member is present and the form field type does not equal set or array, any form field value specified MUST equal one of the values found within the Option array." - the value should equal the option after trim had been applied?
I agree trim can be useful and it would be good if it can be expressed in some kind of validation lifecycle/process where all rules to be performed on a string value should be applied after the trim has been applied.
A certain class of errors surface when a form field string value has leading or trailing whitespace (or both) or is the empty string. It would be ideal if the spec allowed content authors to eliminate these problems and even take a default position to do so.
This issue is a proposal to add a form field member named
trim
that is a string that may have one of 5 possible values:leading
,trailing
both
,tonull
andnone
with the following semantics:leading
: remove any leading whitespace in the field value before further evaluationtrailing
: remove any trailing whitespace in the field value before further evaluationboth
: remove any leading and trailing whitespace in the field value before further evaluation.tonull
: remove any leading and trailing whitespace. If the resulting string is the empty string, replace the value withnull
.none
: don't modify the field value string at all before further evaluation.This field MUST be evaluated before evaluating the
value
against any potentially specifiedpattern
field.This field would only be evaluated if the field
type
isstring
or a string derivative type (likedate
,time
,duration
, etc).If the field
type
isstring
(or a derived string type), and atrim
member is not defined, then Ion parsers MUST assume a behavior oftrim
equal totonull
. This default is chosen as it is assumed that the majority of data processing systems do not want any leading or trailing white space or the empty string for data.Is this a welcome addition? A negative one? Thoughts and opinions welcome.
cc @dogeared @nbarbettini @niklase @fosrias @smizell
The text was updated successfully, but these errors were encountered: