Redirect to url after submitting a form depending on the value of a field

Hi all! I would like to know how I can redirect to an external url automatically once I submit a public form. The only determining factor would be a Toggle type field and depending on the answer it would redirect me or not.

My code so far is like this:

fd.saved(function (result) {
if (fd.field('Toggle1').value == true {
window.location = 'Form - Tally';
}
});

Captura de pantalla 2021-12-29 065953

Excuse me, the writing, my native language is Spanish and I am translating as I can.

Thanks a lot!!!

Hello @belen_costantin,

You can't get field values inside fd.saved() event. If you want to redirect user to the specific page depends on a field value, use this code:

fd.rendered(function() {
    fd.field('Toggle1').$on('change', function(value){

    if (value == true) {
        fd.saved(function (){
            window.location.href = 'Page_URL';
        });
    }
    else {
        fd.saved(function (){
            window.location.href = 'Page_URL';
        });
    }

    });
});
1 Like

thank you!!!! it worked perfectly. :grinning: