# $1 = type # $2 = form variable name # $3 = form variable value # $4 = (radio button) value of button # $5 = string to append # $6 = additional attributes BEGIN { FS="|" } # trim leading whitespaces { gsub(/^[ \t]+/,"",$1) } $1 ~ /^onchange/ { onchange = $2 } ($1 != "") && ($1 !~ /^option/) && (select_open == 1) { select_open = 0 printf "" } $1 ~ /^start_form/ { if ($3 != "") field_opts=" id=\"" $3 "\"" else field_opts="" if ($4 == "hidden") field_opts = field_opts " style=\"display: none\"" start_form($2, field_opts); print "" form_help = "" form_help_link = "" } $1 ~ /^field/ { if (field_open == 1) print "" if ($3 != "") field_opts=" id=\"" $3 "\"" else field_opts="" if ($4 == "hidden") field_opts = field_opts " style=\"display: none\"" print "" if ($2 != "") print "" } print "" } $1 ~ /^caption/ { print "" $2 "" } $1 ~ /^string/ { print $2 } $1 ~ /^text/ { print "" $4 } $1 ~ /^password/ { print "" $4 } $1 ~ /^upload/ { print "" } $1 ~ /^submit/ { print "" } $1 ~ /^helpitem/ { form_help = form_help "
@TR<<" $2 ">>:
" } $1 ~ /^helptext/ { form_help = form_help "
@TR<<" $2 ">>
" } $1 ~ /^helplink/ { form_help_link = "
@TR<>
" } ($1 ~ /^checkbox/) || ($1 ~ /^radio/) { print $5 } $1 ~ /^end_form/ { if (field_open == 1) print "" field_open = 0 print "
" $2 "" else print "" field_open=1 } $1 ~ /^checkbox/ { if ($3==$4) opts="checked=\"checked\" " else opts="" if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\"" print "" } $1 ~ /^radio/ { if ($3==$4) opts="checked=\"checked\" " else opts="" if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\"" print "" } $1 ~ /^select/ { opts = "" if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\"" print "
" items[i] " @TR<>
>\" />
" end_form(form_help, form_help_link); form_help = "" form_help_link = "" }