[Zope] form question

Dennis Moore rainking@feeding.frenzy.com
Wed, 8 Dec 1999 19:26:48 -0600


I have a form that gathers a information in a dtml document.  The form
action is a dtml method which shows this information for the user to verify
in a new form.  The problem is that somewhere along the way, letter is no
longer a list.  I've tried making NAME="letter:list" in the first document,
but that doesn't help.  

I think the solution is in the hidden input in the
first method.  When i make letter = <dtml-var letter> it's just a string
and not a list.  How do I make it a list?

On a related note, if I only select one of the checkboxes, it doesn't get
passed as a list (single element), but just as a bare string when it gets
to the sql method.  Then dtml-in doesn't work on the variable.  How do I
test to see if the variable is a list, or cast it to one in dtml-in?

Also, is there a better way of propagating the namespace?   This is just an
oversimplified version of what I'm actually trying to do.  I would rather
not have to make a 'hidden' line for every variable I want to pass.

I hope a comprehensive, up to date, DTML reference appears soon.

Thanks in advance..  

### dtml document cb_test:

<!--#var standard_html_header-->
<h2><!--#var title_or_id--></h2>
<p>
This is the <!--#var id--> Document. 
<form action=PerformCbVerify method=POST>
<INPUT TYPE="checkbox" NAME="letter" VALUE="a"> A<BR>
<INPUT TYPE="checkbox" NAME="letter" VALUE="b"> B<BR>
<INPUT TYPE="checkbox" NAME="letter" VALUE="c"> C<BR>
<INPUT TYPE="checkbox" NAME="letter" VALUE="d"> D<BR>
<p>
<INPUT TYPE =submit NAME=submit VALUE=Submit> <INPUT TYPE=reset>
</form>
</p>
<!--#var standard_html_footer-->

### dtml method PerformCbVerify:

<!--#var standard_html_header-->
<H2><!--#var title_or_id--> <!--#var document_title--></H2>
<P>This is the <!--#var document_id--> Document in 
the <!--#var title_and_id--> Folder.</P>
You picked:
<form action=PerformCbTest>
<dtml-in letter>
	"<dtml-var sequence-item>"
	<dtml-if sequence-end>.
	<dtml-else>and
	</dtml-if>
<dtml-else>null
</dtml-in>
<p>
<INPUT TYPE=hidden NAME=letter VALUE="<dtml-var letter>">
<INPUT TYPE =submit NAME=submit VALUE=Submit>
</form> 
<!--#var standard_html_footer-->

### dtml method PerformCbTest:

<!--#var standard_html_header-->
<H2><!--#var title_or_id--> <!--#var document_title--></H2>
<P>This is the <!--#var document_id--> Document in 
the <!--#var title_and_id--> Folder.</P>
<dtml-call sqlCbInsert>
<!--#var standard_html_footer-->

### sql method sqlCbInsert:

insert into mytable (letter) values (
<dtml-in letter>
	<dtml-if sequence-start>'{
	</dtml-if>
	"<dtml-var sequence-item>"
	<dtml-if sequence-end>}'
	<dtml-else>,
	</dtml-if>
<dtml-else>null
</dtml-in>)

-- 
pity this busy monster, manunkind,         |    Dennis  Moore    |       Sarah
not. Progress is a comfortable disease.    | rainking@frenzy.com |   McLachlan
   -e.e. cummings: One Times One           |  archon on the irc  |     "Black"
If I cried me a river of all my confessions would I drown in my shallow regret?