[stringtemplate-interest] The select-option problem

Koerner, Ron ron.koerner at wincor-nixdorf.com
Wed Jul 22 08:04:38 PDT 2009


Hi list,

I'm encountering the select-option (or input type=radio) problem:

I have a fixed list of selectable options and a variable matching one of
the selected entries. I want to mark the selected entry in some way,
e.g.:

<input type=radio name=opt value=opt1>
...
<input type=radio name=opt value=opt2 checked=checked>
...
<input type=radio name=opt value=opt3>

if my variable equals "opt2".

I found some quite old mailing list entries that this is not easily
possible and since I can't use list comprehension here it is even more
complicated.

So I have two questions:

1. Is there a possibility to do something like
$if(eq(selected,"opt1"))$checked=checked$endif$ ? It doesn't look like
that based on my inspection of the source code...

2. Shouldn't there be something like this?


As a reason why this is currently not there was stated a violation of
model-view-separation. I think it is the contrary case. The current
feature set requires the model to be adapted to satisfy the view!

Proof:

The business logic requires a selection between several choices of some
kind. So this selected choice is in my model.
The view is simply an text input box which is populated with the current
selection. Some Javascript code ensures no invalid values can be
entered.
Now someone says that looks ugly and wants a selection box or radio
buttons.
There is no possibility to implement that without changing the model,
even if the displayed information is the same.

Regards,
Ron

-- 
WINCOR NIXDORF International GmbH 
Sitz der Gesellschaft: Paderborn 
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller 
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. 



More information about the stringtemplate-interest mailing list