Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit Page Link not outputted in JSON #8

Open
MartinsOsawe opened this issue Nov 15, 2021 · 2 comments
Open

Submit Page Link not outputted in JSON #8

MartinsOsawe opened this issue Nov 15, 2021 · 2 comments

Comments

@MartinsOsawe
Copy link

Hello
thanks for this awesome extension :)

When i set a redirection page link for the submit page, i don't get any information about this in the JSON. Is it possible to set this?

Thank you for your help

Bildschirmfoto 2021-11-15 um 13 15 16

@ducrot
Copy link
Contributor

ducrot commented Dec 9, 2021

Hello!

One possible solution:

Backend TypoScript setup:

plugin.tx_powermail {
    settings {
        setup {
            misc {
                ## Enable ajaxSubmit to get redirect url via data.form.additionalAttributes.data-powermail-ajax-uri
                ajaxSubmit = 1
            }
            finishers {
                ## Disable RedirectFinisher
                100 >
            }
        }
    }
}

Frontend:

export default {

// [...]

 computed: {
    redirect() {
      return this.data.form.additionalAttributes
      && this.data.form.additionalAttributes['data-powermail-ajax-uri']
        ? this.data.form.additionalAttributes['data-powermail-ajax-uri']
        : false
    }
  },

// [...]

  methods: {
    onSubmit() {
      // Do your validation stuff ...
      apiService.postFormdata(this.action, formData, this.$typo3.options.api.baseURL)
        .then(response => {
          if (this.redirect) {
            this.$router.push({
              path: this.redirect
            })
          } else {
            // Show a message!
          }
        })
        .catch((error) => {
          console.error("Error", error);
        });
    }
  },

// [...]

};

@kitzberger
Copy link
Contributor

@MartinsOsawe, I think this has been resolved with #26, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants