1283 Posts
Bucklash
6 years ago
1
Topic

SOLVED: No idea wtf is going on. I think linked to a Menu Item -> Form that was for not in users usergroup, I accessed that page but then chaos ensued. 

Hi

I can redirect to a menu item, but not the content view, is it possible?

1

I have a seblod list menu item:

'my-seb-list'

2

Each list item links to the article content view:

'my-seb-list/my-content-view'

3

Each article does not have a single article menu item

4

On each content view I have a list of comments (using seblod list field in the content view)

5

To edit comment I redirect to comment form page

6

When I save the comment, using 'save and redirect' I can only get back to 'my-seb-list', not 'my-seb-list/my-content-view'

Is it possible?

I see that the menu item ID is the focus of the redirect, not the page you came from

Thanks

Jon

Get a Book for SEBLOD
1283 Posts
Bucklash
6 years ago
0
Level 1

My solution is to save in the form the path of current uri using the live -> URI -> path option. i.e. '/some-list/some-content'

Then in Form view, have faux save button using free text with a variable used in a string replace:

<button type="button" id="question_save_and_redirect" name="question_save_and_redirect" class="uk-button uk-button-secondary" 
onclick="jQuery("#seblod_form input[name='config[url]']").val('$returnPath');JCck.Core.submit("save2redirect");return false;">Save</button>
<br>

And then using beforeRender string replace $returnPath:

if (!$config['isNew']) {
    // redirect saved question back to content view
   $fields['question_save_and_redirect']->form  = str_replace('$returnPath', $fields['question_return_path']->value, $fields['question_save_and_redirect']->form);
}
<br>

But there must be a more efficient way, hmmm

Get a Book for SEBLOD