Jump to content

Redirection after submit by Listbox or Dropdown


Recommended Posts

I have this Submission DataPage with a dropdown/list box. After selecting a certain option, I wanted it to be redirected to another page. I followed this article: 

https://howto.caspio.com/tech-tips-and-articles/common-customizations/dynamic-redirects-after-form-submission/ 

However, the value I want to save is not the link for every option so I came up with this solution:

The script below will automatically redirect you to the new page:

<script type="text/javascript">

document.addEventListener('BeforeFormSubmit', function (event) {

switch (document.getElementById("Id name of your field").value){
  case 'ValueOfOption1':
    window.location="Link of the website";
    break;
  case 'ValueOfOption2':
    break;
  case 'ValueOfOption3':
    break;
 default:
    window.location="Link of your datapage";
}
});
</script>

 

This one here will remain on the same page and at the same time open a new tab for the link:

<script type="text/javascript">

document.addEventListener('BeforeFormSubmit', function (event) {

switch (document.getElementById("Id name of your field").value){
  case 'ValueOfOption1':
    window.open('Link of the website', '_blank');
    break;
  case 'ValueOfOption2':
    break;
  case 'ValueOfOption3':
    break;
 default:
    window.location="Link of your datapage";
}
});
</script>

 

I have found this script from this Forum Post:
 

Quote

 

It really helps me to construct this so BIG THANKS for this! :D

Link to comment
Share on other sites

No need for JS. Create a lookup table which has both values to be saved and links. On your form add a virtual field and select cascading as the form element. Source of this element should be the lookup. Parent field is value and filter by values to be saved and as the value select the link. This virtual field would be the link to be redirected to. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...