[Seaside] RE: [ADD] WASelectTag>>enablementBlock

Boris Popov boris at deepcovelabs.com
Tue Mar 27 20:45:17 UTC 2007


Not sure what your scenario was exactly, but here I have a list that
goes,

Canada
US
---- (disabled)
Armenia
...
Canada
...
US
...
Zimbabwe

in which case 'selected' <option> came up twice during rendering phase
if you'd selected one of the duplicated countries on top and most
browsers would assume it's the latter one you want, so by correcting it
I fix two issues: semantically single list should only have one
'selected' option, but practically if you pick Canada, I want the list
to highlight Canada in the top portion, not the lower one.

Hope this helps,

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris at deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org [mailto:seaside-
> bounces at lists.squeakfoundation.org] On Behalf Of Rick Flower
> Sent: Tuesday, March 27, 2007 1:39 PM
> To: Seaside - general discussion
> Subject: Re: [Seaside] RE: [ADD] WASelectTag>>enablementBlock
> 
> Boris --
> 
> This sounds like something I was dealing with a while back and did
some
> ugly hacks to deal with.. In my case I had several drop-downs with the
> initial selected item being something like "select one" -- but, I
didn't
> want that one item actually selected.. This code sounds like it might
> work in this manner.. I'll check it out -- keeps the hacks away!
> 
> Thanks!
> 
> -- Rick
> 
> Boris Popov wrote:
> > One additional improvement to follow up is the change that makes
sure
> > that single-selection lists don't try to render multiple 'selected'
> > options (in my case, top 15 countries where we ship appear as
duplicates
> > in a separate group on top of the list, but are repeated again
further
> > down for consistency),
> >
> > I bet Outlook will mess up the format big time, my apologies,
> >
> > optionsOn: html
> > 	| brush registeredSelection |
> > 	self isOptional
> > 		ifTrue:
> > 			[brush := (html option)
> > 				selected: selected isNil;
> > 				yourself.
> > 			self hasCallback ifTrue: [brush callback:
> > [callbackBlock value: nil]].
> > 			brush with: optionalLabel].
> > 	registeredSelection := false.
> > 	list
> > 		do:
> > 			[:each |
> > 			brush := html option.
> > 			(self isDisabled: each) ifTrue: [brush
> > disabled].
> > 			((self isMultiple or: [registeredSelection not])
> > and: [self isSelected: each])
> > 				ifTrue:
> > 					[brush selected: true.
> > 					registeredSelection := true].
> > 			self hasCallback
> > 				ifTrue:
> > 					[brush
> > 						callback:
> > 							[self isMultiple
> > 								ifTrue:
> > [selected add: each]
> > 								ifFalse:
> > [callbackBlock value: each]]].
> > 			brush with: (self labelForOption: each)]
> >
> > Cheers!
> >
> > -Boris
> >
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


More information about the seaside mailing list