input_validate (function f, string failure_message, [integer max_times]) ⇒ string
Manual entry not found for function: input_validate.
First available: Version 1.7.3
Examples
The following examples demonstrate this function:
YASS
function check($x) if ($x == "password") return true else return false end if end function $v = input_validate(handle_of(check), "Incorrect password.") print($v)
The next example use input validation to check that a number is within a range:
YASS
$num = input_validate( function($x) $x = value($x) if ($x > 10 && $x < 100) return true else return false end if end function , "Number must be between 10 and 100.") print($num)
This example, submitted to me by one of the testers, was based on something she had written before that inspired this and uses regexps:
YASS
$name = input_validate( function($x) if (string_matches($x, "[A-Z][a-z]+")) return true else return false end if end function , "Name must start with a capital and contain at least one lower case character after.") print($name)

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.
Comments powered by BalfComment