Tk Library Source Code

View Ticket
Login
Ticket UUID: 756948
Title: html::select's use of ncgi not correct ?
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2003-06-19 00:16:19
Subsystem: html Assigned To: welch
Priority: 7 High Severity:
Status: Closed Last Modified: 2006-07-03 03:16:42
Resolution: Invalid Closed By: mic42
    Closed on: 2006-07-02 20:16:42
Description:
tcllib CVS head.

Looking at the implementation of html::select I believe 
that its use of ncgi::valueList together with lsearch is 
incorrect.

The result of valueList is a list of lists. I.e each element 
of the result is a 2-element list containing metadata and 
the value. Using that in lsearch -exact means that the 
string searched for has to be the same. But the string is 
actually only the value of the form element.

Either we have to lindex the result of valueList to strip 
the outer list, or we have to use ncgi::value to get only 
the value for the form element.

Note: The form element select has only one value, not 
multiple ones.
User Comments: mic42 added on 2006-07-03 03:16:42:
Logged In: YES 
user_id=302287

I have to disagree.

The ncgi::valueList returns a list of form values, without
metadata, unless your fetching a multipart/* value (in which
case its an user error anyway).

So its a value list and lsearch simply looks if the value
exists to set it to selected if it exists.

The form element can have multiple values if the 'multiple'
option is specified, multiple options can be selected
(especially common combined with size to get a Tk listbox
style widget).