|
From: <el...@us...> - 2003-09-26 05:42:25
|
Update of /cvsroot/funformkit/FunFormKit
In directory sc8-pr-cvs1:/tmp/cvs-serv21781
Modified Files:
Field.py
Log Message:
Patched SelectField to show labels instead of values when field is static
Index: Field.py
===================================================================
RCS file: /cvsroot/funformkit/FunFormKit/Field.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Field.py 1 Apr 2003 00:29:07 -0000 1.27
--- Field.py 26 Sep 2003 05:42:18 -0000 1.28
***************
*** 1057,1060 ****
--- 1057,1078 ----
for key, value in selections]))
+ def htWidget(self, default, options, nameMap=identity):
+ if options.get("static"):
+ selections = options.get("selections")
+ if selections:
+ f = filter(lambda x: x[0] == default, selections)
+ if f:
+ dispVal = f[0][1]
+ else:
+ dispVal = ""
+ else:
+ dispVal = default
+ return htmlEncode(dispVal) + \
+ self.htHidden(default, options, nameMap=nameMap)
+ elif options.get("hide"):
+ return self.htHidden(default, options, nameMap=nameMap)
+ else:
+ return self.htInput(default, options, nameMap=nameMap)
+
def selected(self, key, default):
if not self._dynamic and self._encodedKeys.has_key(key):
|