[How to make] Check box Non Editable/Non Selectable? without using entry "disabled"

I want to make the check box checked, and Non Editable/Non Selectable

Step 1. checked the check box only
from this tutorial page http://www.hscripts.com/tutorials/html/form-checkbox.php its working checked by add entry “checked” in bold below, and the form working with the check box checked after click submit button :

<input type=“checkbox” checked name=“postpoll” value=“yes” id=“cb_postpoll” tabindex=“1” $checked[postpoll] />

Step 2. make it Non Editable/Non Selectable, so the check box are already checked and cannot unchecked by users

from that same tutorial page its says to add entry “disabled” like below in bold

<input type=“checkbox” checked disabled name=“postpoll” value=“yes” id=“cb_postpoll” tabindex=“1” $checked[postpoll] />

its working the check box being Non Editable/Non Selectable, but after click submit button the form are not working maybe because the check box really disabled, its just pass the checked check box, like there is no check box. Maybe using entry “disabled” is the wrong way

please help guys, how to make the form still working after click submit button, but the check box are already checked and cannot unchecked by users

Maybe use a hidden field instead?

ok i already tried hiden field is not working

somebody suggest this in bold, i think this is the best way if i know how to do that, any body know how to do that?

Why do you need to show such a checkbox in this case? If it’s to checked and cannot be altered, then can’t you just assume the value of $postpoll as yes, in the serverside?

FYI: There’s nothing permanent when it comes in the client side. Users can easily manipulate the html code from their browser using tools like firebug.

this is the entire page code, the check box part are in bold below

$stylevar[htmldoctype]
<html dir=“$stylevar[textdirection]” lang=“$stylevar[languagecode]”>
<head>
$headinclude
<title>$vboptions[bbtitle] - $vbphrase[post_new_thread]</title>
</head>
<body$onload>
$header
$navbar

$postpreview

<form action=“newthread.php?do=postthread&f=$forumid” method=“post” name=“vbform”<if condition=“!is_browser(‘webtv’)”> onsubmit=“return vB_Editor[‘$editorid’].prepare_submit(this.subject.value, $vboptions[postminchars]<if condition=”$show[‘threadprefix’] AND ($vboptions[‘prefixrequired’] == 1 OR ($vboptions[‘prefixrequired’] == 2 AND $foruminfo[‘prefixrequired’]))“>, this.threadprefix.value</if>)”</if>>

<table class=“tborder” cellpadding=“$stylevar[cellpadding]” cellspacing=“$stylevar[cellspacing]” border=“0” width=“100%” align=“center”>
<tr>
<td class=“tcat”>
<span class=“smallfont” style=“float:$stylevar[right]”><strong>$vbphrase[forum]</strong>: <a href=“forumdisplay.php?$session[sessionurl]f=$foruminfo[forumid]”>$foruminfo[title]</a></span>
$vbphrase[post_new_thread]
</td>
</tr>
<tr>
<td class=“panelsurround” align=“center”>
<div class=“panel”>
<div style=“width:$stylevar[formwidth]” align=“$stylevar[left]”>

    $usernamecode

    $imagereg
    &lt;if condition="$foruminfo[g_answer_forum]"&gt;&lt;br&gt;$posticons&lt;/if&gt;
    &lt;!-- subject field --&gt;
    &lt;table cellpadding="0" cellspacing="0" border="0" class="fieldset"&gt;
    &lt;tr&gt;
        &lt;if condition="$show['threadprefix']"&gt;
        &lt;td class="smallfont"&gt;$vbphrase[threadprefix]:&lt;/td&gt;
        &lt;/if&gt;
        &lt;td class="smallfont" colspan="&lt;if condition="$show['threadprefix']"&gt;2&lt;else /&gt;3&lt;/if&gt;"&gt;$vbphrase[title]:&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;if condition="$show['threadprefix']"&gt;
        &lt;td&gt;$threadprefixes&nbsp;&lt;/td&gt;
        &lt;/if&gt;
        &lt;td&gt;&lt;input type="text" class="bginput" name="subject" value="$subject" size="60" maxlength="$vboptions[titlemaxchars]" tabindex="1" /&gt;&lt;/td&gt;           
                &lt;/tr&gt;
    &lt;/table&gt;
    &lt;!-- / subject field --&gt;
       
    &lt;!-- message area --&gt;
    &lt;div class="smallfont"&gt;$vbphrase[message]:&lt;/div&gt;       
    $messagearea
    &lt;!-- / message area --&gt;

<if condition=“in_array($forumid , array(438,5000))”>
<br />
<fieldset>
<legend>Custom Fields</legend>
<table cellpadding=“1” cellspacing=“$stylevar[cellspacing]” border=“0” width=“100%”>
$custom_form
</table>
</fieldset>
</if>
<if condition=“in_array($forumid , array(385,92))”><br><br>
<center>Fitur Untuk Menulis Rumus Matematika/Fisika/Kimia, dll</center>
<center><iframe name=“I1” src=“$vboptions[bburl]/equationeditor/equationeditor.php” border=“0” width=“620” frameborder=“0” height=“405”></iframe></center>
</if>

    &lt;/div&gt;
&lt;/div&gt;
       
&lt;div style="margin-top:$stylevar[cellpadding]px"&gt;
    &lt;input type="hidden" name="s" value="$session[sessionhash]" /&gt;
    &lt;input type="hidden" name="f" value="$forumid" /&gt;
    &lt;input type="hidden" name="do" value="postthread" /&gt;
    &lt;input type="hidden" name="posthash" value="$posthash" /&gt;
    &lt;input type="hidden" name="poststarttime" value="$poststarttime" /&gt;
    &lt;input type="hidden" name="loggedinuser" value="$bbuserinfo[userid]" /&gt;
    &lt;input type="submit" class="button" name="sbutton" id="{$editorid}_save" value="$vbphrase[submit_new_thread]" accesskey="s" tabindex="1" style="font: bold 24px" /&gt;
    &lt;input type="submit" class="button" name="preview" value="$vbphrase[preview_post]" accesskey="r" tabindex="1" /&gt;   
&lt;/div&gt;
&lt;/td&gt;

</tr>
</table>

<if condition=“$show[‘additional_options’]”>
<br />

<table class=“tborder” cellpadding=“$stylevar[cellpadding]” cellspacing=“$stylevar[cellspacing]” border=“0” width=“100%” align=“center”>
<thead>
<tr>
<td class=“tcat”>
<a style=“float:$stylevar[right]” href=“#top” onclick=“return toggle_collapse(‘newpost_options’)”><img id=“collapseimg_newpost_options” src=“$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_newpost_options].gif” alt=“” border=“0” /></a>
$vbphrase[additional_options]
</td>
</tr>
</thead>
<tbody id=“collapseobj_newpost_options” style=“$vbcollapse[collapseobj_newpost_options]”>
<tr valign=“top”>
<td class=“panelsurround” align=“center”>
<div class=“panel”>
<div style=“width:$stylevar[formwidth]” align=“$stylevar[left]”>

            &lt;if condition="$show['podcasturl']"&gt;
            &lt;!-- podcast stuff --&gt;
            &lt;fieldset class="fieldset"&gt;
                &lt;legend&gt;$vbphrase[podcast_options]&lt;/legend&gt;
                       
                &lt;table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"&gt;
                &lt;tr&gt;
                    &lt;td class="smallfont"&gt;$vbphrase[podcast_url]:&lt;/td&gt;
                    &lt;td class="smallfont"&gt;&nbsp;$vbphrase[filesize_bytes]:&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;input type="text" class="bginput" name="podcasturl" value="$podcasturl" size="50" maxlength="255" tabindex="1" title="$vbphrase[podcast_url]" /&gt;&lt;/td&gt;
                    &lt;td&gt;&nbsp;&lt;input type="text" class="bginput" name="podcastsize" value="$podcastsize" size="10" tabindex="1" title="$vbphrase[podcast_size]" /&gt;&lt;/td&gt;   
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td class="smallfont"&gt;$vbphrase[subtitle]:&lt;/td&gt;
                    &lt;td class="smallfont"&gt;&nbsp;$vbphrase[explicit]:&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;input type="text" class="bginput" name="podcastsubtitle" value="$podcastsubtitle" size="50" maxlength="255" tabindex="1" title="$vbphrase[subtitle]" /&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;input type="checkbox" name="podcastexplicit" value="1" tabindex="1" $explicitchecked title="$vbphrase[explicit]" /&gt;&lt;/td&gt;
                &lt;/tr&gt;   
                &lt;tr&gt;
                    &lt;td class="smallfont"&gt;$vbphrase[keywords]:&lt;/td&gt;
                    &lt;td class="smallfont"&gt;$vbphrase[author]:&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;input type="text" class="bginput" name="podcastkeywords" value="$podcastkeywords" size="50" maxlength="255" tabindex="1" title="$vbphrase[keywords]" /&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;input type="text" class="bginput" name="podcastauthor" value="$podcastauthor" size="25" maxlength="255" tabindex="1" title="$vbphrase[author]" /&gt;&lt;/td&gt;
                &lt;/tr&gt;   
                &lt;/table&gt;
            &lt;/fieldset&gt;
            &lt;!-- / podcast stuff --&gt;
            &lt;/if&gt;       
                       
            &lt;if condition="$show['misc_options']"&gt;
            &lt;fieldset class="fieldset"&gt;
                &lt;legend&gt;$vbphrase[miscellaneous_options]&lt;/legend&gt;
                &lt;div style="padding:$stylevar[formspacer]px"&gt;
                    &lt;if condition="$bbuserinfo['signature'] != ''"&gt;&lt;div&gt;&lt;label for="cb_signature"&gt;&lt;input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="1" $checked[signature] /&gt;$vbphrase[show_your_signature]&lt;/label&gt;&lt;/div&gt;&lt;/if&gt;
                    &lt;if condition="$show['parseurl']"&gt;&lt;div&gt;&lt;label for="cb_parseurl"&gt;&lt;input type="checkbox" name="parseurl" value="1" id="cb_parseurl" tabindex="1" $checked[parseurl] /&gt;$vbphrase[automatically_parse_links_in_text]&lt;/label&gt;&lt;/div&gt;&lt;/if&gt;
                    $disablesmiliesoption
                &lt;/div&gt;
            &lt;/fieldset&gt;
            &lt;/if&gt;

            $attachmentoption
                   
            &lt;if condition="$show['member']"&gt;
            &lt;fieldset class="fieldset"&gt;
                &lt;legend&gt;$vbphrase[thread_subscription]&lt;/legend&gt;
                &lt;table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"&gt;
                &lt;tr&gt;
                    &lt;td&gt;$vbphrase[notification_type]:&lt;br /&gt;&lt;select name="emailupdate" tabindex="1"&gt;
                        &lt;option value="9999" $emailchecked[9999]&gt;$vbphrase[do_not_subscribe]&lt;/option&gt;
                        &lt;option value="0" $emailchecked[0]&gt;$vbphrase[no_email_notification]&lt;/option&gt;
                        &lt;option value="1" $emailchecked[1]&gt;$vbphrase[instant_email_notification]&lt;/option&gt;
                        &lt;option value="2" $emailchecked[2]&gt;$vbphrase[daily_email_notification]&lt;/option&gt;
                        &lt;option value="3" $emailchecked[3]&gt;$vbphrase[weekly_email_notification]&lt;/option&gt;
                    &lt;/select&gt;&lt;/td&gt;
                    &lt;if condition="$show['subscribefolders']"&gt;&lt;td&gt;$vbphrase[folder]:&lt;br /&gt;&lt;select name="folderid" tabindex="1"&gt;$folderbits&lt;/select&gt;&lt;/td&gt;&lt;/if&gt;
                &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/fieldset&gt;
            &lt;/if&gt;
           
            &lt;if condition="$show['poll']"&gt;
            &lt;fieldset class="fieldset"&gt;
                &lt;legend&gt;$vbphrase[post_a_poll]&lt;/legend&gt;
                &lt;div style="padding:$stylevar[formspacer]px"&gt;
                    &lt;div&gt;&lt;label for="cb_postpoll"&gt;[B]&lt;input type="checkbox" checked name="postpoll" value="yes" id="cb_postpoll" tabindex="1" $checked[postpoll] /&gt;[/B]$vbphrase[yes_post_a_poll_thread]&lt;/label&gt;&lt;/div&gt;
                    &lt;div&gt;&lt;label for="polloptnum"&gt;$vbphrase[number_of_poll_options]: &lt;input type="text" class="bginput" size="5" name="polloptions" value="$polloptions" id="polloptnum" tabindex="1" /&gt;&lt;/label&gt; &lt;if condition="$vboptions['maxpolloptions']"&gt;($vbphrase[maximum]: $vboptions[maxpolloptions])&lt;/if&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/fieldset&gt;
            &lt;/if&gt;
           
            $threadmanagement
           
            &lt;/div&gt;
        &lt;/div&gt;
       
        &lt;div style="margin-top:$stylevar[cellpadding]px"&gt;
            &lt;input type="submit" class="button" name="sbutton" value="$vbphrase[submit_new_thread]" accesskey="s" tabindex="1" /&gt;
            &lt;input type="submit" class="button" name="preview" value="$vbphrase[preview_post]" accesskey="r" tabindex="1" /&gt;           
        &lt;/div&gt;
    &lt;/td&gt;
&lt;/tr&gt;

</tbody>
</table>
</if>

</form>

<br />

$forumrules

$footer

</body>
</html>

A hidden field is sent to the server but not displayed in the form.

A ‘disabled’ field is displayed in the form but is not sent to the server

A ‘readonly’ field is displayed in the form and sent to the server but cannot be updated.

Sorry if I am not of much help or maybe I am understanding your question wrong, but if

you want to make the check box checked, and Non Editable/Non Selectable

then why should it even be shown?
I know this is not an html or coding solution, but to show the box as checked and not have it uncheckable, couldn’t you use and image of a linked box.

This way it shows the user that the box is always checked.

If the checkbox is permanently checked then I wouldn’t even display it and just use a hidden input to send the value to the server.

But if the checkbox is unchecked on page load and you want to make it unchangeable if it is clicked and then send its value to the server then you could try this.

When the checkbox is clicked, its value is copied to a hidden input and the checkbox is then disabled. But you will need to do something else for the small number of browsers with js turned off that visit your site.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript">

            function setVal(elem) {
                document.getElementById('hidChk1').value = elem.value;
                elem.disabled = true;
            }

        </script>
    </head>
    <body>

        <form action="processForm.php" method="post" >

            <input type="checkbox" name="chk1" id="chk1" value='some_value' onclick="setVal(this)" />

            <input type='hidden' name='hidChk1' id='hidChk1' value='' />

            <input type="submit" value="submit" />

        </form>

    </body>
</html>