Zeichen Anzahl im Textfeld begrenzen

  • hallo,


    Ich habe ein Formular zur Anlage von Produkten durch meine Provider

    In der kurzen Beschreibung will ich die Anzahl der Zeichen Begrenzen

    das habe ich mit maxlength versucht


    <tr>

    {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[descr]" /></td>{/if}

    <td colspan="2" class="FormButton">

    <div{if $active_modules.HTML_Editor and not $html_editor_disabled} class="description"{/if}>{$lng.lbl_short_description}* :</div>

    <div class="description-data">

    {include file="main/textarea.tpl" name="descr" maxlenght=600 cols=45 rows=8 data=$product.descr width="100%" btn_rows=4}

    {if $top_message.fillerror ne "" and ($product.descr eq "" or $product.xss_descr eq "Y")}<font class="Star">&lt;&lt;</font>{/if}

    </div>

    </td>

    </tr>


    die korrespondierende datei textarea.tpl habe ich auch angepasst


    {*

    540830e1020194a4c9dd88e4edf9102270e1c702, v6 (xcart_4_7_7), 2016-08-09 18:00:14, textarea.tpl, aim


    vim: set ts=2 sw=2 sts=2 et:

    *}

    {if $active_modules.HTML_Editor and not $html_editor_disabled}


    {include file="main/start_textarea.tpl" _include_once=1}

    {assign var="id" value=$name|regex_replace:"/[^\w\d_]/":""}

    {if ($usertype eq "A" or $usertype eq "P") and $config.HTML_Editor.editor eq 'ckeditor'}


    <script type="text/javascript">

    //<![CDATA[

    (function() {

    var formidAntiXss = 'bb261163df5069c55ab68b0a40e65d43';

    var imageParentId = '{$entity_id|escape:javascript}';

    var imageParentType = '{$entity_type|escape:javascript}';

    var config_url = 'ckedit_uploadimage.php?formid=' + formidAntiXss + '&image_parent_id=' + imageParentId + '&image_parent_type=' + imageParentType;


    // global object

    xc_ckeditor_config = {

    uploadUrl: config_url,

    filebrowserUploadUrl: config_url,

    imageUploadUrl: config_url + '&type=dragdrop'

    };

    })();

    //]]>

    </script>

    {$allow_upload_image_ckedit=1


    }

    {/if}


    {strip}


    {if $no_links ne "Y"}

    <div class="AELinkBox" style="width: {$width|default:"80%"};">

    <a href="javascript:void(0);" style="display: none;" id="{$id}Dis" onclick="javascript: disableEditor('{$id}','{$name}');">{$lng.lbl_default_editor}</a>

    <b id="{$id}DisB">{$lng.lbl_default_editor}</b>

    &nbsp;&nbsp;

    <a href="javascript:void(0);" id="{$id}Enb" onclick="javascript: enableEditor('{$id}','{$name}', {if $on_js_editor_ready}{$on_js_editor_ready}{else}''{/if}{if $allow_upload_image_ckedit}, xc_ckeditor_config{/if});">{$lng.lbl_advanced_editor}</a>

    <b id="{$id}EnbB" style="display: none;">{$lng.lbl_advanced_editor}</b>

    </div>

    {/if}


    <textarea id="{$id}" name="{$name}"{if $maxlength} maxlength="{$maxlength}"{/if} {if $cols} cols="{$cols}"{/if} {if $rows} rows="{$rows}"{/if} class="InputWidth {$class}" style="width: {$width|default:"80%"};">{if $skip_escape}{$data}{else}{$data|escape}{/if}</textarea>


    <div id="{$id}Box" style="display:none;">


    <textarea id="{$id}Adv"{if $maxlength} maxlength="{$maxlength}"{/if} {if $cols} cols="{$cols}"{/if} {if $rows} rows="{$rows}"{/if} class="InputWidth {$class}" style="width: 576px;{if $no_links eq "Y"}display:none;{/if}">{if $skip_escape}{$data}{else}{$data|escape}{/if}</textarea>


    {if $config.HTML_Editor.editor eq "ckeditor"}

    {include file="modules/HTML_Editor/editors/ckeditor/textarea.tpl" id=$id name=$name data=$data}

    {elseif $config.HTML_Editor.editor eq "innovaeditor"}

    {include file="modules/HTML_Editor/editors/innovaeditor/textarea.tpl" id=$id name=$name data=$data}

    {elseif $config.HTML_Editor.editor eq "tinymce"}

    {include file="modules/HTML_Editor/editors/tinymce/textarea.tpl" id=$id name=$name data=$data}

    {/if}


    </div>

    {/strip}


    <script type="text/javascript">

    //<![CDATA[

    var isOpen = getCookie('{$id}EditorEnabled');

    if (isOpen && isOpen == 'Y')

    $('#{$id}Enb').click();

    //]]>

    </script>


    {else}

    <textarea id="{$id}" name="{$name}"{if $maxlength} maxlength="{$maxlength}"{/if}{if $cols} cols="{$cols}"{/if}{if $rows} rows="{$rows}"{/if} class="InputWidth {$class}" {if $style} style="{$style}"{/if}{if $disabled} disabled="disabled"{/if}>{if $skip_escape}{$data}{else}{$data|escape}{/if}</textarea>


    {/if}


    Das funzt aber nicht,

    irgend eine Idee???


    :?:

  • Dies musst du als attribut bei der textarea einfügen. Nicht als Meta Tag.

    wie gesagt, maxlength funzt "als Attribut" bei den Meta Tags, nur eben nicht in dem code,


    product-set-up.tpl

    {include file="main/textarea.tpl" name="descr" maxlenght=600 cols=45 rows=8 data=$product.descr width="100%" btn_rows=4}


    textarea.tpl

    <textarea id="{$id}" name="{$name}"{if $maxlength} maxlength="{$maxlength}"{/if}{if $cols} cols="{$cols}"{/if}{if $rows} rows="{$rows}"{/if}


    die frage ist ob der html editor das hier ignoriert

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!