Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Redirect To a Specific Page Depending on Form Dropdown


mmontg18

Question

Site URL: https://northshore-village-hoa.squarespace.com/dues-form

I am trying to set up a form to forward someone to a specific page after they choose a specific item from the drop down. I would like to point each option from the drop down - 1 month, 6 months, and 1 year to a different page for each one. 

I tried to work off of this thread -> Custom Redirect Forum Post, but am still unsuccessful. I have the code provided by @creedonin the header, but it's still not forwarding to the sites (they are random sites on my page for now, but will be the correct page in the near future). Any ideas?

Thanks!

Link to comment

8 answers to this question

Recommended Posts

  • 1

In the thread you cite I have updated my October 19, 2020 code post.

Install that code and replace selectFormFieldName and optionUrlMappings.

    const selectFormFieldName = 'Length of Dues';
    
    const optionUrlMappings = {
    
      /*
      
        the format of each line is a select field option as entered in the SS
        form block interface and the post-submit redirect URL for the option
        
        */
        
      // '[enter select field option here]' : '[enter url here]',
      
      '1 Month'  : '/1-month',
      '6 Months' : '/6-months',
      
      // last or only item doesn't get a comma at end of line
      
      '1 Year'   : '/1-Year'
      
      }
      

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
  • 1

The first thing you need to do is set the POST-SUBMIT REDIRECT. The URL should be either a default page. Or in your case it sounds like there is no default as each option will go to its own page. So the redirect should be to an error page you create saying something like sorry there was an error and how to recover, start over, contact you, etc. Whatever makes sense for your situation.

361384780_ScreenShot2021-03-27at8_25_37PM.png.65fd110ffe606c18970b993837fb895e.png

The code examples in that thread are very specific to the site, using references to elements that would only be on the site.

The good news is that the code can be adapted to others sites.

Give me a day or so to tweak the code to work for your site.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
  • 0
On 3/28/2021 at 8:06 AM, mmontg18 said:

Site URL: https://northshore-village-hoa.squarespace.com/dues-form

I am trying to set up a form to forward someone to a specific page after they choose a specific item from the drop down. I would like to point each option from the drop down - 1 month, 6 months, and 1 year to a different page for each one. 

I tried to work off of this thread -> Custom Redirect Forum Post, but am still unsuccessful. I have the code provided by @creedonin the header, but it's still not forwarding to the sites (they are random sites on my page for now, but will be the correct page in the near future). Any ideas?

Thanks!

i also tried it and successful 

Link to comment
  • 0
13 hours ago, creedon said:

@wcbailey

Are you married to having the form set to lightbox? My code wasn't designed to work with lightbox forms.

If not I have updated my cited code.

 

I wasn't sure how to use your updated code because I couldn't get it to work so I just tried to turn the lightbox off. It still isn't working so I am not sure what I broke.

Link to comment
  • 0

@wcbailey

Two issues.

Remove the following line.

<script src="https://d1j8mu9lowy9zf.cloudfront.net/twcsl/0.1d7/twcsl.js"></script>

It is no longer needed for the current code.

The option url pairs should have no empty lines. Following is a partial example.

fbsfpsrc

Alabama
https://www.ckesn.com/state/Alabama

Alaska
https://www.ckesn.com/state/Alaska

Becomes.

fbsfpsrc
Alabama
https://www.ckesn.com/state/Alabama
Alaska
https://www.ckesn.com/state/Alaska

Your URLs could go from https://www.ckesn.com/state/Alabama to /state/Alabama, if you want. Either will work. The latter is an internal URL. You can even mix external and internal forms. The code doesn't care. It just blindly stuffs whatever you type into the proper place for SS to do it's magic with the redirect.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...