Jump to content


  • Posts

  • Joined

  • Last visited

Bamboo's Achievements

  1. Hey @creedon, I turned off Ajax on the site settings and now the form redirects are working perfectly. Thank you so much! I do have a related question though, is it possible to make modifications to the same code to have conditional redirects based on two different dropdown fields? Here's the form in question - https://www.mommyshotsbyamrita.com/booking What I'd like to do is setup conditional redirects based on the dropdown selection for "City" as well as "What can we shoot for you?". Something as follows: City > Bangalore | What can we shoot > Play Date = /Link1 City > Bangalore | What can we shoot > Cake Smash = /Link2 City > Other | What can we shoot > Monthly Milestone = /Link3 And so on.... Really appreciate your help on this!
  2. Hey @creedon! Thanks for this code snippet, I've been searching all over the place for this exact functionality. I've made tweaks to the code you shared to suit my form field ID and the options in the dropdown, but the page redirects work only sometimes - I've done several test submissions but can't really figure out what the trigger is for a redirect. Here's the page with the form - https://www.mommyshotsbyamrita.com/booking I would like to redirect users to a different page based on their selection for the "City" dropdown field. Here's the code I've injected: Settings > Advanced > Code Injection > Header <script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> Page settings > Advanced > Page Header Code Injection <script> $( ( ) => { // begin city redirect const formSelectId = 'select-976d627d-86a6-45a0-9ffd-c6e493cba2dd-field'; const redirects = { /* enter options from select form field and redirect URL Slug or External URL */ 'Chennai' : '/pricingb', 'Bangalore' : '/pricingb', 'Other' : '/pricingo', }; // don't change anything beyond this point let $formSelect = $( '#' + formSelectId ); // get the redirect form let $form = $formSelect.closest ( 'form' ); $formSelect.change ( function ( ) { let url = $( this ).val ( ); if ( url !== '' ) url = redirects [ url ]; $form.attr ( 'data-success-redirect', url ); } ); /* end city redirect */ } ); </script> I would ideally like to have the *City* dropdown after the email field to keep it in a clear flow but I've moved it to the bottom to test out the form functionality. Initially, the redirect seemed to work when the City dropdown was the last from field to be filled out but now the redirect is happening at random.
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.