mapEditorWriteError resets value and form-item level is not always present
In the following program, it is impossible to fill in anything in the editor because the mapEditorWriteError
sub editor keeps resetting the value.
Also, the form-item
level in the DOM is only present when there is an error icon. Because the form-item
adds margin, I think it should always be present (this causes the field to move slightly when the value changes in validity).
import StdEnv
import Data.Func
import iTasks
Start w = doTasks (enterInformation [EnterUsing id editor]) w
editor =
mapEditorWrite combine $
container2 e e
where
combine (?Just x, ?Just y) = ?Just (x, y)
combine _ = ?None
e = mapEditorWriteError check textField
where
check ?None = Error "fill something in"
check (?Just x)
| size x < 3
= Error "fill in at least 3 characters"
= Ok x