It's super frustrating when you want to have a text field (255chars) but the only way to see the entire 255 chars in that field is a really really reeeeally long textfield. Text areas are a thing. We should be able to use them (and not just for longtext text fields).

in Drupal 7, to use a textarea you need to create a whole new field and migrate all your data into it, but the underlying data structure is exactly the same!! This should not be necessary. Let's add the textarea widget as an option for text fields (but leave the existing widget as default)

Comments

jenlampton’s picture

Status: Active » Needs review
jenlampton’s picture

It does help if you remember the patch :)

jenlampton’s picture

Patch still applies to 7.52

jenlampton’s picture

Rerolled for 7.54

jenlampton’s picture

without the docroot this time.

The last submitted patch, 4: core-allow_textfield_textarea_widgets-2479895-4.patch, failed testing.

Munavijayalakshmi’s picture

Assigned: Unassigned » Munavijayalakshmi
Status: Needs review » Needs work
+++ b/modules/field/modules/text/text.module
@@ -511,9 +510,12 @@ function text_field_widget_form(&$form, &$form_state, $field, $instance, $langco
+      // If the field itslef has a maxlenthgh include that on the widget.

Typo errors.

Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.5 KB
new619 bytes
jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies cleanly to Drupal 7.55. Thanks for the cleanup @Munavijayalakshmi.

jenlampton’s picture

Patch still applies cleanly to 7.56.

stefan.r’s picture

Issue tags: +Drupal 7.60 target

Looks good, thanks!

David_Rothstein’s picture

Version: 7.x-dev » 8.5.x-dev
Category: Task » Feature request
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs backport to D7

This is a very nice idea, but it still needs to go into Drupal 8 first. (At least based on my testing, I saw the same behavior in Drupal 8... and I noticed that https://www.drupal.org/project/textarea_widget_for_text has releases for both Drupal 7 and 8 also.)

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jenlampton’s picture

Patch still applies cleanly to 7.57.

chi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB

Rerolled path #8 for 8.6.x.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.58.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.59.

lomasr’s picture

StatusFileSize
new72.26 KB

#15 worked cleanly for me.

amit.drupal’s picture

Patch in #15 still applies cleanly and its working fine.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

pol’s picture

Status: Needs review » Reviewed & tested by the community

This is fine for me.

pol’s picture

mustanggb’s picture

Issue tags: -Drupal 7.60 target +Drupal 7.70 target

This sounds like a great feature, if someone would like to create a D7 backport issue please feel free, but for now bumping the D7 target until D8 version is committed.

Status: Reviewed & tested by the community » Needs work
jenlampton’s picture

Patch in #8 still applies cleanly to 7.60.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.61.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.64.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.66.

jenlampton’s picture

Patch in #8 still applies cleanly to 7.67 and 7.68.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

chi’s picture

Status: Needs work » Reviewed & tested by the community

Back to RTBC as #24 looks like a temporary unrelated failure.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This change looks like a good idea. Considering the patch has logic

+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php
@@ -76,6 +77,11 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
+    // If the field itself has a maxlength include that on the widget.
+    if ($max_length = $this->getFieldSetting('max_length')) {
+      $element['value']['#maxlength'] = $max_length;
+    }

It's worth having a test to make sure we don't break this.

chi’s picture

Status: Needs work » Needs review
StatusFileSize
new4.03 KB

Added a test per #34.

Overall the test coverage of core field widgets is pretty low. We don't even check the actual widget type being rendered.

Status: Needs review » Needs work
chi’s picture

Status: Needs work » Needs review
StatusFileSize
new4.73 KB

Updated TextFieldTest.

jenlampton’s picture

I'm also attaching a Drupal 7 version of the patch (from #8) with tests comparable to those in #36.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jenlampton’s picture

Patch in #37 still applies cleanly to 7.73 and 7.74.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

jenlampton’s picture

Patch in #37 still applies cleanly to 7.78.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jenlampton’s picture

Issue tags: -Drupal 7.70 target +Drupal 7.81 target

Patch in #37 still applies cleanly to 7.80.

ranjith_kumar_k_u’s picture

StatusFileSize
new4.7 KB

Re-rolled #36 for 9.3

Status: Needs review » Needs work

The last submitted patch, 44: 2479895-44.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new4.69 KB
new1.09 KB

Fixed fail tests, It is related to "assertFieldByXPath() is deprecated".

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

immaculatexavier’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Reviewed whether the old patch still applies to the latest code and passes automated tests.

Steps taken to review:

  1. Downloaded the latest patch file.
  2. Used Git to clone local Git repository of 9.3.x of the development version that the issue pertains to.
  3. The patch #46 does not apply.

Result:

So changed the issue status to Needs work.
Added the issue tag "needs reroll".

akashkumar07’s picture

StatusFileSize
new0 bytes

Added reroll for 9.5.x-dev version.

akashkumar07’s picture

StatusFileSize
new4.71 KB

Added reroll for 9.5.x-dev version.

akashkumar07’s picture

Status: Needs work » Needs review
ambikahirode’s picture

StatusFileSize
new68 bytes

patch in #51 applies Cleanly to 9.5.

vikashsoni’s picture

@AkashKumar07 Thanks for the patch patch applied successfully in drupal-9.5

avpaderno’s picture

There is no need to add a screenshot to show the patch applies. Drupal core has tests enabled, and one of their tasks is checking the patch can be applied.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

medha kumari’s picture

Issue tags: -Needs reroll
StatusFileSize
new4.71 KB

Rerolled patch #51 in 10.1.x .

avpaderno’s picture

Title: Allow text fields and textareas to use the other's widgets. » Allow text fields and textareas to use the other's widgets
Issue tags: -Drupal 7.81 target

Status: Needs review » Needs work

The last submitted patch, 57: 2479895-57.patch, failed testing. View results

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.