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

Rick Flower rickf at ca-flower.com
Tue Mar 27 20:39:10 UTC 2007


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
> 



More information about the seaside mailing list