diff --git a/scheme/httpd/surflets/web-server/root/surflets/add-surflet.scm b/scheme/httpd/surflets/web-server/root/surflets/add-surflet.scm index 2c0d4f9..a3fdefa 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add-surflet.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add-surflet.scm @@ -1,9 +1,6 @@ (define-structure surflet surflet-interface (open surflets - surflet-requests url - handle-fatal-error - let-opt scheme-with-scsh) (begin @@ -23,13 +20,12 @@ ,(make-submit-button))) (hr) (p (URL "/" "Return to main menu.") (br) - (URL "add2.scm" "Start new calculation.")))))))) - (if result - (or (input-field-value number-input-field - (form-query (http-url-search - (surflet-request-url result)))) - (get-number title "Please enter a valid number.")) - (get-number title "Please enter a number.")))) + (URL "add-surflet.scm" "Start new calculation."))))))) + (bindings (get-bindings result)) + (number (input-field-value number-input-field bindings))) + (if number + number + (get-number title "Please enter a valid number.")))) (define (get-number1) (get-number "Calculation - Step one" "First number:")) @@ -38,18 +34,16 @@ (get-number "Calculation - Step two" "Second number:")) (define (main req) - (let ((number1 (get-number1)) - (number2 (get-number2))) - (send-html - `(html (title "Result") - (body (h2 "Result") - (p ,(number->string (+ number1 number2))) - (hr) - (p (URL "add-surflet.scm" "Make new calculation.") (br) - (URL "javascript:history.go(-2)" "New calculation (same session)") - (br) - (URL "/" "Return to main menu."))))) + (send-html + `(html (title "Result") + (body (h2 "Result") + (p ,(number->string (+ (get-number1) (get-number2))) + (hr) + (p (URL "add-surflet.scm" "Make new calculation.") (br) + (URL "javascript:history.go(-2)" "New calculation (same session)") + (br) + (URL "/" "Return to main menu.")))))) - "this string will never be evaluated")) + "this string will never be evaluated") )) \ No newline at end of file