Sometime on Aug 2, Will assembled some asciibets to say:

> Now my question...  what do you folks think? Am I being too stubborn
> here, or should I learn the CGI on form writing?  Maybe it would
> just be easiest to design my forms in DW and then set them into
> H::T?  Is this recommended?  What are the pros and cons of this

That's the way I do it - well, I use vi to make my forms, but basically,
yeah, the forms are made as plain html and not built by CGI.pm - if
that's what you were asking.

I generally have something like this:

<form ...>
<table ...>
...
<input type="text" name="name"
        value="<tmpl_var name='name' escape='html'>">
<tmpl_if error_name><span class="error"><tmpl_var error_name></span></tmpl_if>
...
</table>
</form>

The single quotes in the tmpl_var parameters are so that vi's syntax
highlighting doesn't get confused.

In the case of checkboxes or select boxes, I have this:

<select name="items">
<any default entry here>
<tmpl_loop name="items">
<option value="<tmpl_var id>" <tmpl_if selected>selected</tmpl_if>><tmpl_var 
value></option>
</tmpl_loop>
</select>

<tmpl_loop name="items">
<input type="checkbox" name="items" value="<tmpl_var id>" <tmpl_if 
selected>checked</tmpl_if>> <tmpl_var value>
</tmpl_loop>

That works for multiselect lists as well.

The perl has to take care of setting selected for the correct entries,
but that's a small thing.

$ids = "10:3";
@list = map {
        $_->{'selected'} = ($ids =~ /(?:^|:)$_->{'id'}(?::|$)/);
        $_;
} @list;

-- 
Han Solo:
        Chewie and I will check it out, you two stay here.
Luke Skywalker:
        Quietly. There may be more of them out there.
Han Solo:
        Hey, it's me.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to