views:

40

answers:

1

Before:

<input type='checkbox' name='killerFeature' id='killerFeature' 
    <%= param('killerFeature') ? ' checked' : ''%> 
/>

Now:

<select name="killerFeature" id="killerFeature" class="select">
    <option value="1">Enable</option>
    <option value="0">Disable</option>
</select>

How do I insert the same checked (should be 'selected' now I guess?) condition in the select now?

This is a perl app, built using Mojolicious web framework.

Many thanks for your help!

+1  A: 

Yes, the condition should be selected (selected="selected") but i belive you already figured that out from your other post :)

<select name="killerFeature" id="killerFeature" class="select">
    <option value="1" selected="selected">Enable</option>
    <option value="0">Disable</option>
</select>

Also from what i saw there inst a way to create the select like you can for the input as in the below example:

<%= input 'test', type => 'text' %>

So it would be something like:

<%== param('killerFeature') eq $my_var ? ' selected="selected"' : ''; %>

Ofc you would need to replace the above to your current variables and field names.

GL:)

Prix
W3C requires there to be a left and right hand. Instead of 'selected' it should be 'selected="selected"'.
vol7ron