CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • resizable-textarea not resizing
Pages: [1]

Author Topic: resizable-textarea not resizing  (Read 1087 times)

jere

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 1
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
resizable-textarea not resizing
June 22, 2013, 06:29:36 pm
I  have a custom template that I have been working on in which I included a "resizable-textarea" field. It looks like the ones on standard templates, the mouse pointer changes when I hover over the gripper,  but my mouse will not make it resize. I am assuming that I don't have the javascript included for it to work. Is this a reasonable assumption? Can someone point me to what files I should include to make it work?

Thanks.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: resizable-textarea not resizing
June 25, 2013, 08:04:26 am
It's not clear what you are talking about here. What "template" exactly did you make? What page exactly is failing to work as you want it to? Please provide full technical details so we can help.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

jere

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 1
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: resizable-textarea not resizing
June 25, 2013, 01:28:22 pm
Thanks Hershel for following up on my question.

By template, I mean a tpl file to use with a profile to manage the layout. The template is in a custom directory/CRM/Profile/Form/40/ and included in the Edit.tpl in that directory.

It is a screen for users in an admin group that is a summary screen that pulls data from multiple tables and includes a number of custom fields. The textarea field in question is not actually in the profile that is defined using Administer > Custom Data and Screens > Profile. Neither do I refer to it in the hook I use for loading the initial screen. I added the element by just coding the html and making it hidden for the initial screen. Then if the user opts to view/edit that field, I use CRM.api to retrieve the data, assign it to the html, and make the element visible. Any changes are saved back to the database using a CRM.api call again. So nothing goes through the normal functioning of the profile and hook for this element.

Here is the html:
Code: [Select]
<div id="note_element-11" class="resizable-textarea" style="">
<span>
<textarea id="note-11" class="form-textarea textarea-processed form-textarea valid" note=""></textarea>
<div class="grippie" ></div>
</span>
</div>


When I use firebug I can see jquery.textarearesizer.js has been included, but it's functions are not getting called. I suppose I could write the javascript to capture the gripper movement and call the textarea resizer function myself, but would have to study it to see how it all works. I was hoping that if I had the class names correct and the resources loaded it would work.

The page retrieves the data, displays it, and saves correctly, so it would work without the resizing textarea, but the resizing functionality is nice.

If no one knows off hand what to suggest, I can work it out.

Thanks.
« Last Edit: June 25, 2013, 01:35:26 pm by jere »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: resizable-textarea not resizing
June 25, 2013, 05:46:44 pm
Looking at the markup (view source) for a textarea in core that works, it looks like this:

<textarea rows="4" cols="60" name="note" id="note" class="form-textarea required"></textarea>

... and the grippie div is not in the source markup (i.e. must be added by the jscript). So maybe try that if you haven't already.
Protect your investment in CiviCRM by  becoming a Member!

jere

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 1
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: resizable-textarea not resizing
June 25, 2013, 07:49:23 pm
Thank you. That was the information I needed.

I should have seen it. There is a $(document).ready(function() in jquery.textarearesizer.js that if I had noticed and followed, may have clued me to the problem.

I will be more careful about using the Firebug html. I didn't think about the html possible being already modified by javascript.  If I had even looked at the html of the element in the $form array in the smartyDebug window for a page where the resizer worked I may have seen it.

I suppose that if I had created the html for that element in the jquery code, though, I would have had to replicate the code in the document.ready function that calls the TextAreaResizer function. I am pretty new to jquery, but it allows for exciting options and confusing errors.

Thanks again.

Jere


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • resizable-textarea not resizing

This forum was archived on 2017-11-26.