Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
i created a patch for textarea.inc which is adding an option to disable resizing of textareas.
regards peter
Comment | File | Size | Author |
---|---|---|---|
#10 | webform_textarea_resize3.patch | 940 bytes | quicksketch |
#8 | webform_textarea_resize2.patch | 1004 bytes | quicksketch |
#5 | webform_textarea_resize.patch | 1.44 KB | quicksketch |
#3 | textarea_resize.patch.txt | 1.39 KB | pebosi |
textarea_resize.patch.txt | 1.39 KB | pebosi |
Comments
Comment #1
pebosi CreditAttribution: pebosi commentedComment #2
quicksketchThanks 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.
Comment #3
pebosi CreditAttribution: pebosi commentedHi,
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
Comment #4
upupax CreditAttribution: upupax commentedThis works in normal content view, but it stops working when I publish my webform in a block with a php snippet.
Comment #5
quicksketchThanks 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!
Comment #6
quicksketchupupax, 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:
Comment #7
upupax CreditAttribution: upupax commentedtextarea.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.
Comment #8
quicksketchAh, 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.
Comment #9
quicksketchupupax, thanks for testing this out so quickly. I was about to make a 2.5 release with the feature not working. :D
Comment #10
quicksketchDang, and one more change to get this working. To disable resizing, the value must be a boolean FALSE value, 0 will not work.
Comment #11
upupax CreditAttribution: upupax commentedyou got it!!!
thanks man!
Comment #12
upupax CreditAttribution: upupax commentedI 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!
Comment #13
quicksketchNewer 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. :)