Advertisement
GrahamC

validate.r

Apr 13th, 2014
1,104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement