Problem/Motivation

After posting a node-add form with only URL in a field which only 'Link text' is required the form does not allow the user to change his mind and not post anything for the link field.

How to reproduce:

  • Create a link field
  • Do not check the link field option Required field
  • Select Required for Allow link text
  • Open the for to add a new node and add text only for the link URL
  • After submitting the form it will display an error message that the link filed is required
  • Delete the text at the URL and submit the form again (Suppose the user do not want to fill this link anymore)
  • The form will not change the required attribute and will not allow the user to give up inserting something.

The expected outcome would be allow the user to change his mind and not post anything for this field, as it is done before submitting the node-add form for the first time.

Proposed resolution

- Add help text for the 'Link text', something like : The link text will be required if you insert an URL.
- Change the attribute required of 'Link text' in case the user deletes what he/she has input for URL.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Mac_Weber created an issue. See original summary.

chhavik’s picture

Assigned: Unassigned » chhavik
chhavik’s picture

Assigned: chhavik » Unassigned
Status: Active » Needs review
FileSize
1.42 KB

- Added help text for the 'Link text' field.
- Fixed the required condition of the 'Link text' field, when the user deletes what he/she has input for URL.

chhavik’s picture

Ignore Comment #3 as the patch name is incorrect. Attached the correct one here.

Mac_Weber’s picture

Status: Needs review » Needs work

@chhavik thank you for the patch. Don't worry too much about the patch name. It is good to follow the patch name suggestion, but the patch works even if it is different.

Can we change the error message displayed in this case? It reads: Link text field is required. while it is required only when we have input at URL. Then, maybe something like:
Link text field is required if you enter an URL

Mac_Weber’s picture

Title: In case of only 'link text' is requried, then remove the required mark if the user deletes the text entered for URL » In case of only 'link text' is required, then remove the required mark if the user deletes the text entered for URL

just fixing a small typo at the issue title

chhavik’s picture

Status: Needs work » Needs review
FileSize
1.58 KB

Updated the error message as Link text field is required if you enter an URL

Mac_Weber’s picture

looks good

Mac_Weber’s picture

Status: Needs review » Reviewed & tested by the community
chhavik’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.58 KB

Fixed small typo. It should be 'a URL'. Please review it again.

The last submitted patch, 7: remove_required_for_link_text-2634232-7.patch, failed testing.

chhavik’s picture

Updated Unit Test as per the new error message.

Mac_Weber’s picture

Status: Needs review » Needs work

@chhavik the correct wording is "an URL" as in the patch you had posted at #7

The last submitted patch, 10: remove_required_for_link_text-2634232-8.patch, failed testing.

chhavik’s picture

Status: Needs work » Needs review

Ideally it should start with an as it's a vowel. But i googled a lot, a is used with URL and not an.
English can sometimes be funny :)

https://en.wikipedia.org/wiki/Uniform_Resource_Locator

Mac_Weber’s picture

Status: Needs review » Reviewed & tested by the community

@chhavik ok I've found a good explanation for it: http://itknowledgeexchange.techtarget.com/writing-for-business/which-is-...

Thank you for catching that.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

The test changes don't cover the actual 'required' problem, only the text changes themselves.

Since this includes string changes, it could only go into 8.1.x - although it looks like we could skip those and just fix the required behaviour?

Mac_Weber’s picture

Status: Needs work » Reviewed & tested by the community
Parent issue: » #2613924: Link text isn't marked as required

@catch since the strings as they are presented today to the user would be misleading the user, I think they can be considered a bug to be fixed in 8.0.x

Regarding the tests, probably we better add the remaining tests at the parent issue in which we have been discussing all tests which we will do for the required Link fields. These tests are very related and I already had a chat with you on IRC, which came to the comment #57 I posted on the other issue: https://www.drupal.org/node/2613924#comment-10671482

I am changing to RTBC again, but feel free to change the status if you think different or if we need to discuss more on this issue.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

@catch != alexpott (re comment #57 on the other issue) :)

Anyhow I agree with @catch that we should add a test that fails on HEAD but passes with this patch to this issue. The steps outlined in the issue summary look a good place to start...

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

John Cook’s picture

I've done a reroll of remove_required_for_link_text-2634232-12.patch because of March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase.

John Cook’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Needs work » Needs review

Setting to "Needs review" to run the tests.

Mac_Weber’s picture

Status: Needs review » Postponed

Postponing in favor of #2613924: Link text isn't marked as required
Let's use part of the tests that are being added in the other issue.