Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

max length on form fields 12 Jul 2013 14:20 #7939

I am using a form field of type cktext. I'd like to add a maxlength to it. Can this be done?

In the /models/forms/ xml document I have the field:

<field name="introtext"
label="RSADMINISTRATOR_FIELD_INTROTEXT"
alias="introtext"
filter="RAW"
type="cktext"/>


In the models/fields/cktext.php

public function getInput()
{

$this->input = JDom::_('html.form.input.text', array_merge(array(
'dataKey' => $this->getOption('name'),
'domClass' => $this->getOption('class'),
'domId' => $this->id,
'domName' => $this->name,
'dataValue' => $this->value,
'placeholder' => $this->getOption('placeholder'),
'responsive' => $this->getOption('responsive'),
'size' => $this->getOption('size')
), $this->jdomOptions));

return parent::getInput();
}

I'm assuming I can do something here to add ' maxlength="140" ' to the rendered html.

Any ideas?

Andy

Please Log in or Create an account to join the conversation.

max length on form fields 19 Aug 2013 22:02 #10855

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
<field name="introtext"
label="RSADMINISTRATOR_FIELD_INTROTEXT"
alias="introtext"
filter="RAW"
type="cktext"

size="140"   <- HERE
/>

Simple as that.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.071 seconds

For starters it's just so easy to design an app in a way that I'm used to i.e. database first then views followed by customization. The fork system is pure brilliance from a developer standpoint as I can override things and still add and update my projects with minimal effort! Truly amazing to be able to build components in Joomla using incremental refinement without having to do everything by hand. Thanks for the great tool! I am so much more productive now than ever and I can't imagine building components any other way!!!!
Dave (Forum)

Get Started