Advertisement
GrahamC

validate.r

Apr 13th, 2014
3,177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REBOL 0.31 KB | None | 0 0
  1. rebol []
  2.  
  3. num: charset [ #"0" - #"9" #"." ]
  4.  
  5. view layout [
  6.     f1: field
  7.     f2: field
  8.  
  9.     button "valdate" [
  10.         either parse f1/text [ some num end ][
  11.             if error? err: try [
  12.                 decimal? load f1/text
  13.             ][
  14.                 alert "Not decimal value in field"
  15.             ]
  16.         ][
  17.             alert "Non numeric characters in field"
  18.         ]
  19.     ]
  20. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement