?
avatar hans2103
hans2103
6 Jul 2015

I cannot add an internal link to field "Link A", "Link B" nor "Link C" on tab "Images and Links" of the edit content item page.

  • Log in Joomla backend
  • Go to Content > Content Manager
  • Open a random content item
  • Go to tab "Images and Links"
  • Enter "#to-some-position-on-page" in field "Link A"
  • Click button "Save"
  • Go back to "Images and Links"
  • See that the content of field "Link A" has changed from "#to-some-position-on-page" to "/#to-some-position-on-page"

The latter is an internal link on the homepage. Not an internal link on the current content item.
Joomla should not add a slash to the contents of this field.

avatar hans2103 hans2103 - open - 6 Jul 2015
avatar brianteeman
brianteeman - comment - 7 Jul 2015

Actually it is adding more than a /
If Joomla is installed in a subdirectory it includes (eg test-cms) that as well (eg (/test-cms/#to-some-position-on-page


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7352.

avatar brianteeman brianteeman - change - 7 Jul 2015
Status New Confirmed
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 7 Jul 2015
Category Administration
avatar brianteeman
brianteeman - comment - 13 Jul 2015

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/fields/url.php#L57

  // Note that the input type "url" is suitable only for external URLs, so if internal URLs are allowed
    // we have to use the input type "text" instead.

So I assume that this needs to be changed. https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/forms/article.xml#L674


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7352.

avatar justinherrin
justinherrin - comment - 16 Jul 2015

Hello all. I was playing around with this for a bit this morning and was able to successfully achieve the # anchor links concept. However, I don't think it is the best solution because I could not figure out how/where to update the URL Validation portion to accept #my-anchor-link as a valid entry into the Link fields on the edit Article view.

Steps I Took

1.) Added the following code to the form.php file. Code was added in starting at line 1382: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/form.php#L1382

// If it starts with a "#" assume an anchor link.
elseif (substr($value, 0, 1) == '#')
{
  return $value;
}

2.) Please keep in mind this is the part I don't like... I removed validate="url" from the article.xml file at lines 678, 710, and 742.

Ideally there is an adjustment we can make to the URL Validation file to allow # to lead off what people enter into the fields, but I could not figure it out. I tried to add '#' to the $scheme = array() seen on the URL Rule File https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/rule/url.php#L54

Hopefully someone with better knowledge of the URL Validation can add some input here :)

avatar zero-24
zero-24 - comment - 22 Oct 2015

See: #8125

avatar zero-24 zero-24 - change - 22 Oct 2015
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2015-10-22 15:59:15
Closed_By zero-24
avatar zero-24 zero-24 - close - 22 Oct 2015

Add a Comment

Login with GitHub to post a comment