Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Vue from "vue"
export default {
el: "#post-browser",
store,
methods: {
hijackFormAction() {
// Make sure the shortcode for the form
// has ajax set to false.
const matches = document.querySelectorAll(".gform_wrapper form")
const slug = store.state.currentPost.slug
matches.forEach(function(match) {
let gformID = match.getAttribute("id")
let isolatedID = /([1-9][0-9]*)/.exec(gformID)
match.setAttribute("action", `/${slug}/#gf_${isolatedID[0]}`)
})
},
},
updated() {
this.$nextTick(() => {
this.hijackFormAction()
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.