Site in read-only mode

This site is now read-only following the release of MyBB 1.8 and the new mods site.

If you are looking for MyBB 1.8 mods please click here to visit the new mods site.

You can continue to download submissions for MyBB 1.6 and earlier here, however new submissions will only be accepted via the new mods site.

Limit the Number of Characters in a Text Field

Limit the Number of Characters in a Text Field


Home » Template Sets » Default Templates
Edit Template: newthread

replace

PHP Code:
<html>
<
head>
<
title>{$lang->newthread_in}</title>
{
$headerinclude}
<
script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</
head>
<
body>
{
$header}
{
$preview}
{
$thread_errors}
{
$attacherror}
<
form action="newthread.php?fid={$fid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
<
input type="hidden" name="my_post_key" value="{$mybb->post_code}/>
<
table border="0" cellspacing="{$theme['borderwidth']}cellpadding="{$theme['tablespace']}class="tborder">
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->post_new_thread}</strong></td>
</
tr>
{
$loginbox}
<
tr>
<
td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<
td class="trow2">{$prefixselect}
<
input name="subject" type="text" onKeyDown="limitText(this.form.subject,this.form.countdown,200);" 
onKeyUp="limitText(this.form.subject,this.form.countdown,200);" size="60" maxlength="200" value="{$subject}">
<
font size="1">
You have <input readonly type="text" name="countdown" size="3" value="200"characters left.</font>
</
form>
<
script language="javascript" type="text/javascript">
function 
limitText(limitFieldlimitCountlimitNum) {
    if (
limitField.value.length limitNum) {
        
limitField.value limitField.value.substring(0limitNum);
    } else {
        
limitCount.value limitNum limitField.value.length;
    }
}
</
script>

</
td>
</
tr>
{
$posticons}
<
tr>
<
td class="trow2" valign="top"><strong>{$lang->your_message}</strong>{$smilieinserter}</td>
<
td class="trow2">
<
textarea name="message" id="message" rows="20" cols="70" tabindex="2">{$message}</textarea>
{
$codebuttons}
{
$multiquote_external}
</
td>
</
tr>
<
tr>
<
td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
<
td class="trow1"><span class="smalltext">
<
label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="7"{$postoptionschecked['signature']} /> {$lang->options_sig}</label>
{
$disablesmilies}</span></td>
</
tr>
{
$modoptions}
{
$subscriptionmethod}
{
$pollbox}
{
$captcha}
</
table>
{
$attachbox}
<
br />
<
div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->post_thread}tabindex="4" accesskey="s" />  <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}tabindex="5" />{$savedraftbutton}</div>
<
input type="hidden" name="action" value="do_newthread" />
<
input type="hidden" name="posthash" value="{$posthash}/>
<
input type="hidden" name="attachmentaid" value="" />
<
input type="hidden" name="attachmentact" value="" />
<
input type="hidden" name="quoted_ids" value="{$quoted_ids}/>
<
input type="hidden" name="tid" value="{$tid}/>
{
$editdraftpid}
</
form>
{
$forumrules}
{
$footer}
</
body>
</
html


http://www.mybb.vn

[img]https://lh3.googleusercontent.com/-YCn4miL5zFI/T5LZdPZkzgI/AAAAAAAAAqc/CZ5MuIwFt8U/s940/MyBB.vn-untitled.PNG[/img]