Support » Developing with WordPress » Javascript submit form, but also using name=”submit” on page

  • Resolved bananenkopf

    (@bananenkopf)


    Hey there,

    I have a front-end theme-driven form where users can add posts.
    the submit button has the name=”submit”

    I have a javascipt function running to submit the post only if some conditions are true.

    form.submit();

    Now the problem is, the javascript.submit function can’t work if there is anything elese called “submit”, like in this case, the name of the button. (Thats what I already know, and also tested.)

    <input type="submit" name="submit"

    Is there a way to run the function by not changing the name=”” of the button?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why can’t you change the name of the button?

    Because the form wont work anymore when I change it.

    Moderator bcworkz

    (@bcworkz)

    I assume you cannot change the receiving code so that the submit name is not required. In that case, you could essentially write your own submit method that collects form field values, assembles them into an HTTP request, then sends the request.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript submit form, but also using name=”submit” on page’ is closed to new replies.