Support » Plugin: Contact Form 7 » Input Type Submit Not Sending with Form Data

  • Amy

    (@germanpearls)


    Following your instruction on this post (multiple submit buttons) I’ve added 2 submit buttons with different values.

    However, when I click either of them, the value is not being sent. (I can’t see it in the dev tools or access it from my code.)

    Here is what I have in place of the submit button in my form editor:

    <input type="submit" name="your-submit" value="Save Task" /> <input type="submit" name="your-submit" value="Start Working" />

    Any thoughts on why it’s not being sent with the other form data?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Amy

    (@germanpearls)

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    I confirmed this behavior. It only works in non-Ajax submission. I’ll look into it. For the meanwhile I suggest copying the value of button to a hidden input field using JavaScript.

    Amy

    (@germanpearls)

    For those looking to perform this function here’s how I accomplished it.

    Javascript function:

    function submit_and_continue(){
        var btn = document.getElementsByName('what-next');
        btn[0].value = 'SaveAndContinue';
    }

    Then I created this form element, with a default value set:
    [hidden what-next default:"Save"]

    And on my form, there are 2 submit buttons, the first just saves the form. The second uses the js function to send a SaveAndContinue in the what-next hidden field.

    <input type="submit" name="submit-save" value="Save">
     <input type="submit" name="submit-continue" value="StartAndContinue" onclick="submit_and_continue()">

    Then, when I parse the response I look for the Save vs SaveAndContinue and base my follow up action on that.

    • This reply was modified 1 month, 3 weeks ago by Amy. Reason: make it easier to read
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.