Hello, I'm trying to set the link field as required in the manage field form but it gives me the error message that it should be giving on the node edit form: "At least one title or URL must be entered."

Comments

WilliamB’s picture

Can't believe none else has faced that issue?

I just can't put required for a link field, it gives me the error : At least one title or URL must be entered.

yched’s picture

Status: Active » Closed (duplicate)

Patch in #1038444: Extra required indicator shoudl fix that.

dqd’s picture

Status: Closed (duplicate) » Active

patch in #1038444: Extra required indicator is obsolete and error still reproducible

dqd’s picture

Title: Can't put the link field as required in a content type : "At least one title or URL must be entered." » "multiple-value" & "required" breaks input/save and produces error: "At least one title or URL must be entered."
Priority: Normal » Major
dqd’s picture

Status: Needs review » Active
Issue tags: +D7 stable release blocker

REMOVED -> D7 stable release blocker

dqd’s picture

Priority: Major » Normal
Status: Active » Needs review

Since the in #2 mentioned but sadly never committed patch of davereid from January didn't fit on the newer code automaticly no more, I had to manually apply it and create a retrieved version of it.

Here we go, let me know ... http://drupal.org/node/1038444#comment-5037138

dqd’s picture

Status: Active » Fixed
Issue tags: -D7 stable release blocker +scheduled for beta1

we got to catch up. I reviewed by myself on 3 test installs. seems to work. committed to latest dev and marked for beta1

geert’s picture

Hello, Just installed and tested the beta1 release. I encounter 2 similar problems. Please let me know if you prefer a new issue.

1- at the creation of a content type, I marked my link field as required. When creating the content type, I entered a value for the link title and the URL. Upon saving, I get an error that at least on needs to be eneterd. To solve this, I no longer marked the field as required, and now it works.

2- As I wanted to make a screenshot to document the issue, I flagged required again. Upon saving the content type, I got the error that error "At least one title or URL must be entered." again.

regards

Geert

dqd’s picture

geert, please use latest dev and report back (all info about why above)

but thx 4 your report!

geert’s picture

Tried the dev version. Same behaviour.

bcn’s picture

Status: Fixed » Active

I can also confirm the same issue as geert. When trying to save a required URL (with optional title), I receive the "At least one title or URL must be entered." even if the URL is in the form field.

What worked for me was to change:

..
  if ($instance['settings']['url'] == 'optional' && $instance['settings']['title'] == 'optional' && $instance['required'] && !$optional_field_found) {
..

To this (notice the ===):

..
  if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] == 'optional' && $instance['required'] && !$optional_field_found) {
..

There might be other cases that should be changed to === as well...

dqd’s picture

thx noahb! often it is because of the small things in such cases.

thank you for pointing it out!

noahb++

orakili’s picture

Status: Active » Needs review
StatusFileSize
new630 bytes

Here's a patch from #11.

dqd’s picture

Status: Needs review » Fixed

thanks orakili and noahb! committed to latest dev. seems to work (here).

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