Re: [Select Tag] setting option text

Sven Van Caekenberghe <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Wow, never heard of #dispatchCallback ;-)

Can this also not be done simply with #labels:

	html select
		list: #(25 50 75 100);
		labels: [ :each | each asString , ' miles' ];
		callback: [ :value | ... ]

?

> On 26 Jan 2019, at 09:18, Johan Brichau <[email protected]> wrote:
> 
> Hi Sergio,
> 
> You can render options directly. Here’s the gist of it:
> - use WAHtmlCanvas>>option brush nested in a ’select’.
> - use #dispatchCallback to ‘dispatch’ the callback from the select tag to the nested option tags.
> 
> html select
> 	dispatchCallback;
> 	with: [ 
>  		html option
> 			value: 50;
> 			callback: [ aBlock value: 50 ];
> 			label: ‘500 Miles’.
> 
> 		html option
> 			value: 100;
> 			callback: [ aBlock value: 100 ];
> 			label: ‘100 Miles’ ]
> 
> Cheers
> Johan
> 
>> On 26 Jan 2019, at 07:32, sergio ruiz <[email protected]> wrote:
>> 
>> I am creating a select for options like:
>> 
>> - 25 miles
>> - 50 miles
>> - 75 miles
>> - 100 miles
>> 
>> The miles part, i don’t want, i just want the value..
>> 
>> i am currently setting list: for an array of the above values..
>> 
>> i get:
>> 
>> <select id="selectDistance" class="form-control" name="2”>
>> <option value="1">25 Miles</option>
>> <option value="2">50 Miles</option>
>> <option value="3">75 Miles</option>
>> <option value="4">100 Miles</option>
>> </select>
>> 
>> i am wondering if i could do something that would allow me to set the value and the text.. 
>> 
>> so the value would be 25 or 50, etc..
>> and the text in the option would be 25 miles, 50 miles, etc..
>> 
>> so i would  get:
>> 
>> <select id="selectDistance" class="form-control" name="2”>
>> <option value=“25">25 Miles</option>
>> <option value=“50">50 Miles</option>
>> <option value=“75">75 Miles</option>
>> <option value=“75">100 Miles</option>
>> </select>
>> 
>> so setting the selected: 50 would mark the appropriate option as selected.
>> 
>> Thanks!
>> 
>> Thanks!
>> 
>> ----
>> peace,
>> sergio
>> photographer, journalist, visionary
>> 
>> Public Key: http://bit.ly/29z9fG0
>> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
>> http://www.codeandmusic.com
>> http://www.twitter.com/sergio_101
>> http://www.facebook.com/sergio101
>> _______________________________________________
>> seaside mailing list
>> [email protected]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.