
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-17-2018 10:44 AM
The setRedirectURL() function does not work in the Portal, as documented here. If your page has a form widget for example, any redirects you built into you UI actions will fail - the portal just stays on the page after submission.
We've found a way to get around this restriction, by adding another widget to the page, which handles the submission event.
The only thing this widget needs is the following client controller code. It will grab the scope of the form and attach a function to the submission event. That function can then be used to take action based on the button that was pressed.
function() {
var c = this;
var formScope = $('#xfd1f4ec347730200ba13a5554ee4abcd').scope(); // The ID of the DOM element that holds the form. This should be the hashtag sign, then the letter 'x', then the sys_id of the Form widget (not the instance) that holds your record.
var gForm;
formScope.$on('spModel.gForm.initialized', function(e, gFormInstance) {
gForm = gFormInstance;
});
formScope.$on('sp.form.submitted', function (){
if (gForm.getActionName() == "sysverb_update"){ // This is the "Action name" of the UI Action
location.href = "?id=page1_id";
}
if (gForm.getActionName() == "other_action_name"){
location.href = "?id=page2_id";
}
});
}
Add that widget to a page that has the OOB "Form" widget, and you're good to go.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Benjamin,
I have this requirement exactly. Seeing this post made me quite happy, but then I can't seem to make it works.
Console tells me formscope isn't defined. As it's been 6 years, perhaps some elements have changed. Did you by any chance make a newer version of this? #fingerscrossed.
Thanks and have a great week-end.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I also wasn't able to get this to work, does anyone have an update on this? Thanks!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Davilu.
We managed to make it work and have been using this logic quite extensively for one of our customer, working almost exclusively on portal.
Perhaps I can help you.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hey @Julien, thanks! Was your team able to implement the above solution? When I try it out, I get a console error about $on being undefined.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
We have followed the same logic described above (intercepting the submit event and pushing some client logic before triggering the server logic in an "invisible" widget) to develop something that works quite well now.
It works only for pages when the form widget is there though.
If you want, I can provide you a cleaned-up version of what we came up with
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
that would be super helpful, thanks!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Sure, I can do that.
Won't have much time to sanitize and comment it before the middle of next week though.
Don't hesitate to remind me if you haven't heard from me by Thursday COB 😉