Make add examples look the same.

This commit is contained in:
interp 2003-01-16 12:09:49 +00:00
parent 0656602636
commit c9c7eb0a90
3 changed files with 17 additions and 17 deletions

View File

@ -17,7 +17,7 @@
(p
(form (@ (method "get")
(action ,new-url))
,input-text
,input-text " "
(input (@ (type "text")
(name "number"))
(input (@ (type "submit"))))))
@ -43,11 +43,12 @@
(send-html/suspend
(lambda (new-url)
`(html (title "Result")
(body (h1 "Result")
(body (h2 "Result")
(p ,(number->string (+ (get-number1) (get-number2))))
(a (@ (href "add.scm")) "new calculation (new session)")(br)
(a (@ (href "javascript:history.back(2)")) "new calculation (same session)")(br)
(a (@ (href ,new-url)) "close this session")))))))
(hr)
(a (@ (href "add.scm")) "New calculation (new session)")(br)
(a (@ (href "javascript:history.back(2)")) "New calculation (same session)")(br)
(a (@ (href ,new-url)) "Close this session")))))))
;; How to clear session data and go to another HTML page:
(send/finish
(make-error-response (status-code moved-temp) req

View File

@ -64,7 +64,7 @@
<HTML>
<TITLE>Result</TITLE>
<BODY>
<H1>Result</H1>
<H2>Result</H2>
<P>
~a
<P>

View File

@ -7,16 +7,15 @@
scheme-with-scsh)
(begin
(define number-input-field (make-number-input-field '(@ (maxlength 10))))
(define number-input-field (make-number-input-field))
(define (get-number input-text . maybe-update-text)
(let* ((update-text (:optional maybe-update-text ""))
(result
(define (get-number title input-text)
(let* ((result
(send-html/suspend
(lambda (new-url)
`(html (title ,input-text)
`(html (title ,title)
(body
(p (font (@ (color "red")) ,update-text))
(h2 ,title)
(p
(servlet-form ,new-url
,input-text " "
@ -28,21 +27,21 @@
(if result
(or (input-field-value number-input-field
(form-query (http-url-search (request-url result))))
(get-number input-text "Please enter a valid number."))
(get-number input-text "Please enter a number."))))
(get-number title "Please enter a valid number."))
(get-number title "Please enter a number."))))
(define (get-number1)
(get-number "First number:"))
(get-number "Calculation - Step one" "First number:"))
(define (get-number2)
(get-number "Second number:"))
(get-number "Calculation - Step two" "Second number:"))
(define (main req)
(let ((number1 (get-number1))
(number2 (get-number2)))
(send-html
`(html (title "Result")
(body (h1 "Result")
(body (h2 "Result")
(p ,(number->string (+ number1 number2)))
(hr)
(p (URL "add2.scm" "Make new calculation.") (br)