Strange settings of CreateTextArea() ?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
Milhaus

Strange settings of CreateTextArea() ?

Post by Milhaus »

Hi again,
I am currently trying to use Questions module. However, default configuration doesn't fit my needs as textarea for asking a question is vast for my needs. Default output seems like:

Code: Select all

<textarea name="m8input_question" cols="80" rows="15"></textarea>
and I would like to lower number of cols.
So I changed function CreateTextArea() in fuction.default_form.php to:

Code: Select all

CreateTextArea(false,$id,'','input_question','','','',30,30));
This works, but only partly. It changes numer of Cols to 30, but not rows to 30 (remains 15, as default). I think, that this behavior isn't also in conformity with API DOCs, where it says:
CreateTextArea (line 1623)

Returns the xhtml equivalent of a textarea. Also takes WYSIWYG preference into consideration if it's called from the admin side.
void CreateTextArea (bool $enablewysiwyg, string $id, string $text, string $name, [string $classname = ''], [string $htmlid = ''], [string $encoding = ''], [string $stylesheet = ''], [string $width = '80'], [string $cols = '15'], [string $forcewysiwyg = ""])

    * bool $enablewysiwyg: Should we try to create a WYSIWYG for this textarea?
    * string $id: The id given to the module on execution
    * string $text: The text to display in the textarea's content
    * string $name: The html name of the textarea
    * string $classname: The CSS class to associate this textarea to
    * string $htmlid: The html id to give to this textarea
    * string $encoding: The encoding to use for the content
    * string $stylesheet: The text of the stylesheet associated to this content. Only used for certain WYSIWYGs
    * string $width: The number of characters wide (columns) the resulting textarea should be
    * string $cols: The number of characters high (rows) the resulting textarea should be
    * string $forcewysiwyg: The wysiwyg-system to be forced even if the user has chosen another one
I think it's very strange, when parameter for rows number is named cols. According to my experience, it really works like cols, not like rows parameter.

Can you explain me this strangeness and help to set number of rows?

Thanks in advance,

Milhaus
alby

Re: Strange settings of CreateTextArea() ?

Post by alby »

Milhaus wrote: So I changed function CreateTextArea() in fuction.default_form.php to:

Code: Select all

CreateTextArea(false,$id,'','input_question','','','',30,30));
CreateTextArea (line 1623)

Returns the xhtml equivalent of a textarea. Also takes WYSIWYG preference into consideration if it's called from the admin side.
void CreateTextArea (bool $enablewysiwyg, string $id, string $text, string $name, [string $classname = ''], [string $htmlid = ''], [string $encoding = ''], [string $stylesheet = ''], [string $width = '80'], [string $cols = '15'], [string $forcewysiwyg = ""])

    * bool $enablewysiwyg: Should we try to create a WYSIWYG for this textarea?
    * string $id: The id given to the module on execution
    * string $text: The text to display in the textarea's content
    * string $name: The html name of the textarea
    * string $classname: The CSS class to associate this textarea to
    * string $htmlid: The html id to give to this textarea
    * string $encoding: The encoding to use for the content
    * string $stylesheet: The text of the stylesheet associated to this content. Only used for certain WYSIWYGs
    * string $width: The number of characters wide (columns) the resulting textarea should be
    * string $cols: The number of characters high (rows) the resulting textarea should be
    * string $forcewysiwyg: The wysiwyg-system to be forced even if the user has chosen another one
Check the function API and the calling module because:
- in function API $with and $height are in position 9 and 10
- in calling module are in position 8 and 9

Alby
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Strange settings of CreateTextArea() ?

Post by calguy1000 »

You can override the cols and rows in css.... it's relatively easy you should not have to modify code.

i.e: 
textarea {
  height: 8em;
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Milhaus

Re: Strange settings of CreateTextArea() ?

Post by Milhaus »

calguy1000 wrote: You can override the cols and rows in css.... it's relatively easy you should not have to modify code.

i.e: 
textarea {
  height: 8em;
}
Thats the solution I hoped for. That also means (I think), that there should be no default settings for cols and rows, but these values should be in default stylesheet coming with module.
alby wrote: Check the function API and the calling module because:
- in function API $with and $height are in position 9 and 10
- in calling module are in position 8 and 9

Alby
I will try it... For now, I created textarea by hand.

Thank you both,

Milhaus
Locked

Return to “Developers Discussion”