onSubmit Catalog Client Script will not save on redirect

ljschwaberow
Giga Expert

I am wanting to create a pop up alert that confirms a catalog item has been submitted and then redirect the user to a specific CMS page instead of the Request. I tried creating a ui page to accomplish this but realized that the requested item is not being saved. The pop up and redirect works but it doesn't retain the requested item. Has anyone been able to create a pop up and   then redirect the user and have the catalog item be saved? FYI   - I am running on Eureka.

1 ACCEPTED SOLUTION

Lindsey,



It's true that we shouldn't modify the OOB objects. I suggested only if you need the redirection globally for all items. Alternatively you can try the below code in an onSubmit catalog client script under the catalog item.



function onSubmit() {


    //Type appropriate comment here, and begin script below


    alert('Your item has been submitted!');


    setTimeout(function(){ window.location = '/catalog_home.do'; }, 2000);     //Make the redirection to happen after 2s. Meanwhile the request gets submitted successfully.


}


View solution in original post

3 REPLIES 3

guhann
Mega Guru

Hi Lindsey,




Do you need this for all the catalog items or only for specific? If you need it for all globally then you may modify the UI page for checkout view to redirect to different page.


Hi Guhan,



It will most likely be for all Catalog Items but this is our first one developed, so it's hard to say for sure. Is it possible just to change it for this specific catalog item the way I am trying to do it?


We just want to skip the order status page and go straight to our list of Open Requests in the CMS site. I'd prefer not to the alter the Checkout UI page because I've heard it's not recommended but if the onSubmit won't work do you know where in the checkout view I change this?


Lindsey,



It's true that we shouldn't modify the OOB objects. I suggested only if you need the redirection globally for all items. Alternatively you can try the below code in an onSubmit catalog client script under the catalog item.



function onSubmit() {


    //Type appropriate comment here, and begin script below


    alert('Your item has been submitted!');


    setTimeout(function(){ window.location = '/catalog_home.do'; }, 2000);     //Make the redirection to happen after 2s. Meanwhile the request gets submitted successfully.


}