Browser goto not inserting id as a query parameter

I got a form that creates a support ticket and want to redirect to the support page after the form is submitted successfully. So I’m using the sc success dynamic event and set a redirect to the right url using the Browser element:

dmx-on:success="browser.goto('/my-account/support/'+scf_new_support_ticket.data.insert_support_ticket.identity)"

When this dynamic event is disabled the id of the newly created database insert (scf_new_support_ticket.data.insert_support_ticket.identity) is output to the page properly and shown in the console, however, it’s not added to the browser.goto url when the dynamic event is enabled. The redirect does work, but without the id as a query parameter.

Any idea what’s wrong here?

Hi.
Can you please check in the Network tab as well as via dmx.app.data... to identify is this id was actually returned or not after form submit?

Hi @sid,

Yes it is properly returned, that's what I meant here:

However when I enable the dynamic event and try to add that same returned value to the redirect path it fails to add it there.

In onsuccess, probably try to run browser1.alert with this expression in that. See if value is returned there.

What does the value look like?

As an alternative, have you had a look at redirecting on the server?

Thanks @sid, I tried and it returns the static value only in the alert:
/my-account/support/

Still the identity value is returned in the by the sc action properly according to the XHR tab:
image

The value is just an id, so a number.
I tried the server redirect too, the correct url is returned in the Network tab, but the actual redirect doesn’t happen… No idea why, no errors are thrown.

Got it working!

I was using he browser element from the layout page to perform the redirect, which didn’t work.
Using another browser element on the content page now solved the issue.

Is this a bug @teodor? The browser element from the layout page works fine for all other browser action on all my content pages…

Couldn’t get it working still with the server side redirect by the way.

Thanks for your help @sid and @ben, appreciate it.

1 Like

Check the browser component DMX link is actually in your layout page, this could happen if it was missing.

2 Likes

Or the an open layout page was not saved after including the browser component.

1 Like

Like the above two posts suggests, there is something wrong on your page. Like you say, its working on other content pages, so it makes this more likely.
Maybe try removing the browser component now and try again?

1 Like

I figured it out and solved it, thanks to you @ben @sid @Hyperbytes

The problem was that the browser component in the layout page had been pushed down by server connect elements. I moved it back to the top, right after the body opening tag and that solved the problems :raised_hands:

Thanks to all for your replies and suggestions, really appreciate it! :clap:

1 Like