Hi fossilers, I'm trying to implement checkboxes within tickets using TH1. First question -- has anyone managed to do this?
In common I have: set status_choices {New Features Uninteresting} While the database column is "status". I've tried the following: <th1> for {set i 0} {$i < [linecount $status_choices 50 0] } {set i [expr $i+1]} { html "<input type=\"checkbox\" name=\"status\" value=\"[lindex $status_choices $i]\" " if {[string compare [lindex $status_choices $i] status ] eq 0} { html "checked" } html "/>[lindex $status_choices $i]" } </th1> Which doesn't work because upon submission, only the first checkbox is ever recorded. So I thought I might get clever and get around this with the "preview" button by using intermediate variables for each checkbox. I.e., checkbox 0 has name "status_0", which ALMOST works, but I can't dynamically call my variable... so I would be stuck hardcoding. Is dynamic variable calling possible in TH1? <th1> if { ![info exists status] } {set status ""} for {set i 0} {$i < [linecount $status_choices 50 0] } {set i [expr $i+1]} { if { [info exists status_$i] } { set status $status "\n" $status_$i } } html "Status: $status. " set status_regexp [lindex $status 0] for {set i 1} {$i < [linecount $status 50 0] } {set i [expr $i+1]} { set status_regexp "$status_regexp|[lindex $status $i]" } if {![info exists status]} {set status "New"} for {set i 0} {$i < [linecount $status_choices 50 0] } {set i [expr $i+1]} { html "<input type=\"checkbox\" name=\"status_$i\" value=\"[lindex $status_choices $i]\" " if {[ regexp $status_regexp [lindex $status_choices 0] ]} { html "checked" } html "/>[lindex $status_choices $i]" } </th1> Any help would be appreciated! Even if it is to tell me that what I'm doing can't be done in TH1. Maybe the HTML parser for the form submission could simply append multiple instances of the same name either as new lines or as commas? Thanks, Tomek
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users