SCSelectHtmlInput


SeasideTesting-Form Components

Comment:



Hierarchy:

ProtoObject
Object
SCXMLElementWrapper
SCHtmlInputComponent
SCSelectHtmlInput

Summary:

instance variables:

options selectedOptions

methods:

instance class
initialize private-options request testing value no messages

Detail:

instance variables:

options
inferredType:
UndefinedObject
selectedOptions
InitialValue:
an OrderedCollection()
inferredType:
OrderedCollection

instance methods:

initialize
initializeForForm: aForm element: anXMLElement
 
	super initializeForForm: aForm element: anXMLElement.
	self initializeOptions.
initializeOptions

	options _ (self allElements
				select: [:each | each name asLowercase = 'option'])
				collect: [:each | SCSelectOption forSelect: self fromXMLElement: each]

private-options
optionSelected: anOption
 
	selectedOptions _ Array with: anOption
selectedOptions

	^selectedOptions ifNil: [selectedOptions _ OrderedCollection new]

request
addToRequestStream: aStream
 
	self selectedOptions
		do: [:option | option addToRequestStream: aStream] separatedBy: [aStream nextPut: $&]

testing
isSelectInput

	^ true

value
selectOptionWithText: text

	self selectOptionWithText: text ifNone: [self error: 'No option labeled ' , text.]
selectOptionWithText: text ifNone: aBlock
 
	| option |
	option _ options detect: [:each | each label = text] ifNone: [^ aBlock value].
	option select.
value: aValue
 
	self
		selectOptionWithText: aValue

class methods:

^top


- made by Dandelion -