You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2012/04/30 15:53:33 UTC
svn commit: r1332205 - in /tcl/rivet/trunk: ChangeLog
rivet/packages/form/form.tcl
Author: mxmanghi
Date: Mon Apr 30 13:53:33 2012
New Revision: 1332205
URL: http://svn.apache.org/viewvc?rev=1332205&view=rev
Log:
* rivet/packages/form/form.tcl: Patch provided by Jeff Lawson to manage -label switches.
The package now requires package uuid from Tcllib.
* : Entry of 2012-04-07 amended as the path to mod_rivet.[c|h] was clearly wrong
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/rivet/packages/form/form.tcl
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1332205&r1=1332204&r2=1332205&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Mon Apr 30 13:53:33 2012
@@ -1,5 +1,10 @@
+2012-04-30 Massimo Manghi <mx...@apache.org>
+ * rivet/packages/form/form.tcl: Patch provided by Jeff Lawson to manage -label switches.
+ The package now requires package uuid from Tcllib.
+ * : Entry of 2012-04-07 amended as the path to mod_rivet.[c|h] was clearly wrong
+
2012-04-07 Massimo Manghi <mx...@apache.org>
- * rivet/packages/mod_rivet.[c|h]: One more change to an ap_log_error call suggested
+ * rivet/apache-2/mod_rivet.[c|h]: One more change to an ap_log_error call suggested
by the compilation hardening flags
2012-03-26 Massimo Manghi <mx...@apache.org>
Modified: tcl/rivet/trunk/rivet/packages/form/form.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/form/form.tcl?rev=1332205&r1=1332204&r2=1332205&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/form/form.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/form/form.tcl Mon Apr 30 13:53:33 2012
@@ -192,38 +192,38 @@ package provide form 1.0
# field declaration
import_data $type $name data $args
- # generate the field definition
- set string "<input type=\"$type\" name=\"$name\""
- append string [argstring data]
-
switch -- $type {
"radio" -
"checkbox" {
- # if there's no value defined, create an empty value
- if {![info exists data(value)]} {
- set data(value) ""
- }
- # if there's no label defined, make the label be the
- # same as the value
- if {![info exists data(label)]} {
- set data(label) $data(value)
+ # if there's a label then prepare to output it.
+ if {[info exists data(label)]} {
+ # if there's no id defined, generate something unique so we can reference it.
+ if {![info exists data(id)]} {
+ set data(id) "autogen_[::uuid::uuid generate]"
+ }
+ set label "<label for=\"$data(id)\">$data(label)</label>"
}
# ...and if the is a default value for this field
# and it matches the value we have for it, make
# the field show up as selected (checked)
- if {[info exists DefaultValues($name)]} {
- if {[lsearch $DefaultValues($name) $data(value)] >= 0} {
- append string { checked="checked"}
+ if {[info exists DefaultValues($name)] && [info exists data(value)]} {
+ if {[lsearch $DefaultValues($name) $data(value)] >= 0} {
+ set data(checked) "checked"
}
}
}
}
- append string " />"
+ # generate the field definition
+ set string "<input type=\"$type\" name=\"$name\" [argstring data] />"
+ if {[info exists label]} {
+ append string $label
+ }
# ...and emit it
- html $string
+ html $string
+
}
#
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org