Log in

View Full Version : make checkbox checked


Evil X
11-24-2005, 03:28 PM
how do I make a checkbox checked by default

<if condition="$show['vbookieevent']">
<fieldset class="fieldset">
<legend>$vbphrase[post_a_vbookieevent]</legend>
<div style="padding:$stylevar[formspacer]px">

<div><label for="cb_postvbookieevent"><input type="checkbox" name="postvbookieevent" value="yes" id="cb_postvbookieevent" tabindex="1" $checked[postvbookieevent] />$vbphrase[yes_post_a_vbookieevent_thread]</label></div>

</div>
</fieldset>
</if>

Alan @ CIT
11-24-2005, 04:54 PM
Add:checked="checked" to the <input> tag.

Marco van Herwaarden
11-24-2005, 08:20 PM
Isn't it just "checked"?

And you would be breaking the progam logic. The following is already setting checked if it is needed:
$checked[postvbookieevent]
If you want to change the behaviour, i suggest you look into the code.

merk
11-24-2005, 09:24 PM
I think some people used checked="checked" because its believed to be necessary. Ive only ever used checked or selected, though.

Marco van Herwaarden
11-24-2005, 09:28 PM
Lol not all browser like the checked=checked

Dontom
11-25-2005, 11:13 AM
This is normal HTML syntax.
<input type="radio" name="Typ" value="bla" checked>

However, to be XHTML-compliant you should use it like this
<input type="radio" name="Typ" value="bla" checked="checked">

Thomas