def digits = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
def isdigit(word) { member(word, digits) };
def isgreater(number, word) { number <> "" && (int_of_string(number) >> idx(word, digits)) };
def nextpage (x, y) {
<html><body><h1>You typed {[ x, ", ", y ]}</h1></body></html>
};
defrec page (a, b) {
<html><body><h1>Test page</h1>
<form l:action={if isdigit(a) && isgreater(b, a) then nextpage(a, b) else page(a, b)}>{[
if a == "" || isdigit(a) then <font>Type a single digit as a lowercase word </font>
else <font color="red">{[a, " is not a lowercase digit name! "]}</font>,
<input l:name="a" type="text" value={a}/>,<br/>,
if a == "" || not(isdigit(a)) then <font/>
else if b == "" then <font>Type a numerical value greater than {[a]}</font>
else if isgreater(b, a) then <font>Well done! </font>
else <font color="red">{[b, " is not greater than ", a]}</font>,
<input l:name="b" value={b}/>,<br/>,
if not(javascript) || (isdigit(a) && isgreater(b, a))
then <input type="submit"/>
else <input type="submit" disabled="disabled"/>]}</form>
</body></html>
};
page("", "");