Jump to content
Sign in to follow this  
Perzival

Redirect on Submit

Recommended Posts

I am trying to create a custom Redirect in my DataPage.

First off, I have a dropdown which the user will select the value from. If the user select A then he should be redirected to DataPage X, if the user select B then redirect to DataPage Y, if the user selected option C then should be redirected to DataPage Z.

 Pseudo:

If (dropdown.option =='A') {

return.redirect(https://DataPageX);

    elseif (dropdown.option == 'B') {

return.redirect(https://DataPageY);

    elseif (dropdown.option == 'C') {

return.redirect(https://DataPageZ);

}

else {return 'Invalid';}

}

}

 

Share this post


Link to post
Share on other sites

Hi @Perzival

This can be achieved using JavaScript. You may just want to use Switch method on that. Here's an article: https://www.w3schools.com/js/js_switch.asp

Switch method example:

<script>

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

switch (document.getElementByClassName('cbFormSelect').value); {
  case A:
    window.location="https://google.com";
    break;
  case B:
    window.location="https://youtube.com";
    break;
  case C:
     window.location="https://gmail.com";
    break;
}
});
</script>


Note: If you are using a field that is created from the table then make sure to save your URL's in that particular field. If you're using a Virtual field, you may enable custom values and insert your URL's in that field.

Important

You should pass the field's parameter on exit then choose "go to another page" at the last part of submission. From the URL field, paste the parameter and hit finish.

 

Cheers,

~ H

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...