Hi,

i created a patch for textarea.inc which is adding an option to disable resizing of textareas.

regards peter

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pebosi’s picture

Status: Active » Needs review
quicksketch’s picture

Thanks pebosi! I'm sure this will make for some happy users that don't want this behavior. The patch should probably use an isset() check prior to using the value though, as currently this will cause PHP Notices when 'multiple' isn't set, which is currently true for all existing installations.

pebosi’s picture

FileSize
1.39 KB

Hi,

i added an isset instead of checking the value, hope that is what you meant.
i've got a little problem with setting a default value on "function _webform_defaults_textarea" if i set resizeable to 1, i cant get it off...

regards

upupax’s picture

This works in normal content view, but it stops working when I publish my webform in a block with a php snippet.

quicksketch’s picture

Status: Needs review » Fixed
FileSize
1.44 KB

Thanks pebosi! Sorry this fell off radar for a little while. Turns out I gave you the wrong approach anyway, since we now have the _webform_defaults_textarea() function at the top of textarea.inc, we just needed to specify a default property there. The change is in this patch, which I've already committed. Thanks for your help!

quicksketch’s picture

upupax, that's because textarea.js is not loaded on the page. By the time blocks are loaded, the header of the page has already been set, so it's not automatically pulled in. You can fix this by manually setting the $scripts variable in your mytheme_preprocess_page() function:

function mythemename_proprocess_page(&$vars) {
  $vars['scripts'] = drupal_get_js();
}
upupax’s picture

textarea.js is loaded in my page. I can see it looking at firebug console.
I've noticed that the "resizable" checkbox is always checked, even if i saved it as unchecked!
I've tried to apply #5 patch but this didn't solve the issue, the checkbox is always on.

quicksketch’s picture

FileSize
1004 bytes

Ah, sure enough, so the problem still remains. I've pinned down the cause of this problem to our submit handler, looks like I was removing "empty" values, including 0. This was intended to prevent empty strings, such as a blank height or width value. Switching this to a better check solves the problem.

quicksketch’s picture

upupax, thanks for testing this out so quickly. I was about to make a 2.5 release with the feature not working. :D

quicksketch’s picture

FileSize
940 bytes

Dang, and one more change to get this working. To disable resizing, the value must be a boolean FALSE value, 0 will not work.

upupax’s picture

you got it!!!
thanks man!

upupax’s picture

I don't know how to tell you, but I've noticed that in Safari the textarea is still resizable.
It's not a big issue, but I just thought you want to know it.
BTW I'm satisfied just to have it solved in firefox. :)
Thanks again!

quicksketch’s picture

Newer versions of Safari make all textareas resizable, it's a browser level feature. There are ways of turning it off, but I'd prefer to stay out of that. Thanks for testing. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.