1
cbuehrle
XoopsFormTextArea Javascript Events
  • 2005/12/23 16:57

  • cbuehrle

  • Just popping in

  • Posts: 4

  • Since: 2005/12/23


I am creating a XoopsFormTextArea and adding it as an element to a form.

le="color: #000000"><?php $techinfo_textarea = new XoopsFormTextArea("Technical Information: ", "techinfo", "", 6, 75);


I want to limit the amount of characters that are entered into the textarea to 1000 characters. I have a javascript function that I would normally call in the textarea tag like this:

le="color: #000000"><?php <textarea onKeyDown=textCounter(this.form.description,1000)> </textarea>


How would I call the javascript function when using the XoopsFormTextArea function?

2
wtravel
Re: XoopsFormTextArea Javascript Events

Hi,

You can try this:

le="color: #000000"><?php $techinfo_textarea = new XoopsFormTextArea("Technical Information: ", "techinfo", "", 6, 75); $techinfo_textarea->setExtra('onKeyDown=textCounter(this.form.description,1000)');


The setExtra option function allows you to add your custom parameters.

Best wishes

3
cbuehrle
Re: XoopsFormTextArea Javascript Events
  • 2005/12/23 18:00

  • cbuehrle

  • Just popping in

  • Posts: 4

  • Since: 2005/12/23


Oh I see. Thank you very much!

Where is the appropriate place to add javascript function? Should I append the include/xoops.js file or create a separate one per module?

4
wtravel
Re: XoopsFormTextArea Javascript Events

You can choose either way of course, if the javascript is only used in that module I'd create a custom .js file or just add it to the template, depending on the number of files I use the same js code in. The advantage of that over adding the custome script to xoops.js is that you do not need to bother about it in XOOPS upgrades