?
avatar djohn95870
djohn95870
27 Feb 2014

I am having issue when using below code in plugin xml.

maxlength is not working.

< field name="phone" type="text" default="" label="Phone" description="Phone: Must not be greater than 13 numbers" maxlength="13" />

or

< param name="phone" type="text" default="" label="Phone" description="Phone: Must not be greater than 13 numbers" maxlength="13" />

Please let me know what need to be done or i am doing wrong.

Thanks in advance.

avatar djohn95870 djohn95870 - open - 27 Feb 2014
avatar Bakual
Bakual - comment - 27 Feb 2014

Please use the google group for questions. See https://groups.google.com/forum/#!forum/joomla-dev-general
This is not a support forum.

avatar Bakual Bakual - change - 27 Feb 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-02-27 09:23:34
avatar Bakual Bakual - close - 27 Feb 2014
avatar Bakual Bakual - close - 27 Feb 2014
avatar zero-24 zero-24 - close - 27 Feb 2014
avatar djohn95870
djohn95870 - comment - 27 Feb 2014

Hi,

I am not sure that it is a bug in Joomla 2.5 version. but i checked that in libraries\joomla\html\parameter\element\text.php in function fetchElement, the maxlength attribute is not being added in input field. I just added it as below.

public function fetchElement($name, $value, &$node, $control_name){
$size = ($node->attributes('size') ? 'size="' . $node->attributes('size') . '"' : '');
$maxlength = ($node->attributes('maxlength') ? 'maxlength="' . $node->attributes('maxlength') . '"' : '');
$class = ($node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="text_area"');
$value = htmlspecialchars(htmlspecialchars_decode($value, ENT_QUOTES), ENT_QUOTES, 'UTF-8');
return ' . ' ' . $size . ' ' . $maxlength . ' />';
}

avatar wilsonge
wilsonge - comment - 1 Mar 2014

Hi,
Your right maxlength clearly has never been implemented in JParameter or JForm in 2.5 or 3.x. If you wish to submit a code to implement this I'm sure it will be gratefully accepted and probably implemented :)

avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment