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
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 sergio.rrd@gmail.com 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 http://bit.ly/29z9fG0 #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV http://www.codeandmusic.com http://www.codeandmusic.com/ http://www.twitter.com/sergio_101 http://www.twitter.com/sergio_101 http://www.facebook.com/sergio101 http://www.facebook.com/sergio101_______________________________________________ seaside mailing list seaside@lists.squeakfoundation.org mailto:seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
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 johan@inceptive.be 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 sergio.rrd@gmail.com 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 seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
seaside mailing list seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Let me try this.. thanks!
On January 26, 2019 at 10:30:40 AM, Sven Van Caekenberghe (sven@stfx.eu) wrote:
html select list: #(25 50 75 100 <//25 50 75 100>); labels: [ :each | each asString , ' miles' ]; callback: [ :value | ... ]
---- 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
Ha, yes, in this case that’s the easier solution ;) Directly rendering the options themselves is not required for this case.
Johan
On 26 Jan 2019, at 16:30, Sven Van Caekenberghe sven@stfx.eu wrote:
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 johan@inceptive.be 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 sergio.rrd@gmail.com 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 seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
seaside mailing list seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
seaside mailing list seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
I ended up doing this:
html select list: #(25 50 75 100 <//25 50 75 100>); labels: [ :each | each asString , ' miles' ]; callback: [ :value | … ]
works perfectly..
refactored the mess i made to handle al this into just 2 accessors..
thanks!
On January 28, 2019 at 1:22:01 AM, Johan Brichau (johan@inceptive.be) wrote:
Ha, yes, in this case that’s the easier solution ;) Directly rendering the options themselves is not required for this case.
Johan
---- 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@lists.squeakfoundation.org