<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 1, 2017 at 2:24 AM, <a href="mailto:jtuchel@objektfabrik.de">jtuchel@objektfabrik.de</a> <span dir="ltr"><<a href="mailto:jtuchel@objektfabrik.de" target="_blank">jtuchel@objektfabrik.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
<br>
I needed a way to add an attribute of each option in a select list, because Seaside uses the value attribute for its server side callback.<br>
<br>
The reason was I wanted to do something on the browser side onChange/onKeyUp based on some business values.<br>
<br>
<br>
Here is what I changed in WASelectTag:<br>
<br>
* added inst var: itemConfigBlock with getter and setter<br>
<br>
* changed #renderListItemLabelled: to<br>
<br>
<br>
renderListItem: anObject labelled: aString<br>
<br>
    | option |<br>
<br>
    option := canvas option.<br>
    self hasCallback ifTrue: [option value: (self valueFor: anObject)].<br>
    titleBlock isNil ifFalse: [option title: (self titleFor: anObject)].<br>
    itemConfigBlock ifNotNil: [:block | block value: option value: anObject].<br>
    option<br>
        selected: (self isSelected: anObject);<br>
        disabled: (self isEnabled: anObject) not;<br>
        with: aString<br>
<br>
<br>
And this is how you can use it:<br>
<br>
<br>
html select<br>
<br>
    items: MyListOfItems;<br>
<br>
    callback: [];<br>
<br>
    itemConfigBlock: [:option :anObject| option attrbibuteAt: 'data-value' put: anObject someValue asString].<br>
<br>
<br>
Was this available already and did I overlook it?<br>
<br>
Does this sound reasonable? Worth adding to Seaside?<br>
<br>
<br></blockquote><div><br></div><div>Yes, I had to do exactly the same. </div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br></div>
</div></div>