[REBOL] Re: Imbedding rebol code in a dialect
From: tim:johnsons-web at: 25-Sep-2002 8:12
Hello Martin:
* Andrew Martin <[Al--Bri--xtra--co--nz]> [020924 20:54]:
> Just need to return a block! of:
> input/type/name/value "hidden" (Field) (Value)
> for each 'field, in the paren! just inside the 'form block! value.
>
> I'd use my 'Map function here ('cause it returns a block!). Something like:
>
> print ML compose/deep [
> form/action/method (cgl[get path thru "process"]) "POST" [(
> Map required-fields function [Field [string!] [Value] [
> Value: cgl [get Value Field] ; This line seems a bit odd!
'cgl is a dispatch function for the 'cgi object. I got tired of
typing forward slashes :-)
> compose/deep [
> input/type/name/value "hidden" (Field) (Value)
> ]
> ]
> )] ; Note the _two_ closing brackets!
> ]
>
> I've attached my very latest 'Map function, with the necessary 'Arguments
> function.
Thanks! I'll check that out. In the meantime, I wrote a quick a dirty
help function:
cgi-to-hidden: func[v[block! string!] /local str val][
either string? v[
if not val: cgl[get value v][val: ""]
str: copy ml[input/type/name/value "hidden" (v) (val)]
][ str: copy ""
repeat name v[
if not val: cgl[get value name][val: ""]
append str ml[input/type/name/value "hidden" (name) (val)]
] ]
]
; and take note that cgl[get value name] <=> cgi/get/value name
; and for snippet of the calling code
form/action/method (cgl[get path thru "process"]) "POST"[
(cgi-to-hidden required-fields)
(cgi-to-hidden optional-fields)
; etc, etc, ....
<sigh>so much to do, so much to learn</sigh>
Thanks again Andrew.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com