[Seaside] Two part input.
Richard Durr
richard.durr at googlemail.com
Mon Feb 8 18:33:26 UTC 2010
I have Model objects I want users to edit using Magritte. For one of
the MAStringDescriptions I want it asFollows: the user can select a
predefined value from a list or type an own String into a textinput.
Whenever the textinput contains text, I want to use that, the value of
the list otherwise.
I created an own component class with the following methods:
renderInputOn: html
html select
id: self labelId , 'predefinedOptions';
addAll: self predefinedOptions;
callback: [:v | self take: v ];
selected: ((self predefinedOptions includes: self string) ifTrue:
[self string] ifFalse: [nil]).
html textInput
callback: [:v | self take: v ];
id: self labelId;
value: ((self predefinedOptions includes: self string) ifTrue: ['']
ifFalse: [self string]).
take: anObject
anObject isEmpty ifFalse: [self string: anObject ]
predefinedOptions
^ self description propertyAt: #predefinedOptions ifAbsent:[Array new.]
That works, but is very unelegant, since it relies of the order of
inputs, for example. Anyone a better Idea how to update using two
callbacks at once? ^^
RD
More information about the seaside
mailing list