seeking affirmation? look no further than the
Validator Contraption:
Works much like a field, but will display informative (or annoying) text below if the value doesn't pass muster.
The validation rule(s) are provided in the script of the contraption instance, by filling out the "on check" function. This function is given the current text, and may return either an error message (a string) or the number 0 if the text is valid. In the above example, the validation function looks like so:
%%WGT0{"w":[{"name":"validator1","type":"contraption","size":[128,41],"pos":[173,242],"def":"validator","widgets":{"v":{},"e":{}}}],"d":{"validator":{"name":"validator","size":[128,41],"resizable":1,"margin":[89,5,6,22],"description":"a text input field with configurable validation rules.","script":"on is_valid x do 0~me.event[\"check\" x] end\non get_valid do is_valid[v.text] end\non get_text do if is_valid[v.text] v.text else 0 end end\non set_text x do if is_valid[x] v.text:x end end\n\non change x silent do\n err:card.event[\"check\" v.text]\n e.text:if 0~err\n if !silent card.event[\"change\" x] end\n \"\"\n else\n err\n end\nend\n\non view do\n v.font :card.font\n v.locked:card.locked\n v.show :card.show\n e.show :card.show\n change[v.text 1]\nend","template":"on change x do\n \nend\n\non check x do\n \nend","attributes":{"name":["text"],"label":["Text"],"type":["string"]},"widgets":{"v":{"type":"field","size":[120,17],"pos":[4,4]},"e":{"type":"field","size":[120,14],"pos":[4,23],"locked":1,"border":0,"style":"plain"}}}}}