edited by caymuc (I put in Astaran's corrections of the instructions):
Original title was "6.1.1: Count letters of Signature in profile"
Changed that as my instructions were for the Bio, actually. But that all would work for the signature as well, of course. You actually can use the script for both fields with a few changes in the code, I think. - I'll neet to figure out, how.-------
Where: EditBasic
---
What: A counter of how many letters are still free for use in the bio field.
---
Note: To change the default of how many letters can be uses maximum, change the number at that code in my hack:
var maxlang=250;
---
Status of the hack: Works well in 6.1.1.
---
Status of the instructions: beta - let me know if you understand this here and get it working
---
Example: running on my board; login info, see signature below.
---
Autor: Me, Myself and I
------------
In EDITBASIC.PHP
Replace:$formmethod = "<form method="post" action="{$config['phpurl']}/changebasic.php">";
By: // Count-hack next line, name="Profil" added:
$formmethod = "<form name="Profil" method="post" action="{$config['phpurl']}/changebasic.php">";
and
Replace: $formmethod = "<form method="post" enctype='multipart/form-data' action="{$config['phpurl']}/changebasic.php">";
By:// Count-hack next line, method="post" added:
$formmethod = "<form name="Profil" method="post" enctype='multipart/form-data' action="{$config['phpurl']}/changebasic.php">";
(Scream, why don't you give all forms a "name" by default? Makes JavaScripts easier to apply.
)
In EDITBASIC.TMPL
After:{$ubbt_lang['PROF_HEAD']} $Username
</td>
</tr>
</table>
</td>
</tr>
</table>
Insert this:<!-- Count-hack begin -->
<script language="javascript" type="text/javascript">
<!--
var formfeld=" ";
var maxlang=250;
function z()
{
if (window.document.Profil.Bio.value.length>maxlang)
{
window.document.Profil.Bio.value=formfeld;
return;
}
else
{
formfeld=window.document.Profil.Bio.value;
window.document.Profil.anzeigen.value=maxlang-window.document.Profil.Bio.value.length;
}
}
//-->
</script>
<!-- Count-hack end -->
and
replace the full line starting with:<textarea name="Bio"
by these two lines:<!-- Count-hack begin -->
<textarea name="Bio" cols="$TextCols" rows="$TextRows" wrap="soft" class="formboxes" onkeyup="javascript:z()">$Bio</textarea>
<input type="text" value="-?-" name="anzeigen" class="formboxes" size="3" />
<!-- Count-hack end -->