link to edit view - create return parameter with JavaScript Topic is solved

For Joomla! 4.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
cappuccino
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Aug 04, 2009 3:49 pm
Location: Hamburg
Contact:

link to edit view - create return parameter with JavaScript

Post by cappuccino » Mon Jun 27, 2022 2:20 pm

Hi,

In my template I do have links like this to access the edit view of an article. The <id> parameter gets included by the template (Yootheme Pro). Want I want to do is to generate the proper return parameter [RETURN] by using JavaScript:

Code: Select all

/labelmanager/label-create?task=article.edit&return=[RETURN]&a_id=<id>
Any ideas?

cappuccino
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Aug 04, 2009 3:49 pm
Location: Hamburg
Contact:

Re: link to edit view - create return parameter with JavaScript

Post by cappuccino » Tue Jun 28, 2022 8:41 am

Hi,

I figured out a way doing this with Regularlabs Sourcerer by adding this somewhere in a div with an id on my page

Code: Select all

<div id="uri_base64encoded">{source}<?php 
use Joomla\CMS\Uri\Uri;
echo base64_encode(Uri::getInstance()); ?>{/source}</div>
This is a example of the link I need to create dynamically:

Code: Select all

/myarticleeditview?task=article.edit&return=[RETURN]&a_id=<id>
The id gets added automatically by the template framework (Yootheme Pro with a table/table 9 element) and the [RETURN] string gets replaced by JavaScript:

Code: Select all

$('.fs-table-column.fs-table-link .el-link.uk-button').each(function() {
        if (this.href.indexOf('-create') != -1) {   
                    this.href = this.href.replace('[RETURN]', $('#uri_base64encoded').text());
        }
});


Post Reply

Return to “Joomla! 4.x Coding”