Home Forums Front-end Issues Multi Submit Button With Different Return


Multi Submit Button With Different Return

  • Hello, i need a help for my frontend form.

    01.I need to set multi submit button, but for different “return” redirect link.
    02. How can i get Field Value from my url link ?
    Ex.”xxx” > Get Value from a field_name ( not the post title ) base on this ID, and set as default value on field_name into new submission.

    Thank you.

    my link is like https://domain/?user=1&parent=165
    i place this code into my page template

    if (isset($_GET['user']))
        $user = $_GET['user'];
    } else {
    	$user = '1';
    	 'id' => 'form',
             'post_id' => 'new_post',
             'field_groups' => array(ID), // Used ID of the field groups here.
             'post_title' => true, // This will show the title filed
             'post_content' => false, // This will show the content field
             'form' => true,
             'new_post' => array(
                 'post_type' => 'customer_data',
    			 'post_author' => $user,  // Where $user_id is a number
                 'post_status' => 'publish' // You may use other post statuses like draft, private etc.
    		 // 'return' => '/?user=' . $user . '&parent=%post_id%',
             'submit_value' =>__("Submit Addons", 'acf'),
    		 'html_submit_button'  => '<input type="submit" id="next" class="acf-button button button-primary button-large" name="addons_btn" value="%s" />
    		 <input type="submit" id="done" class="acf-button button button-primary button-large" value="Submit Details" style="position: relative; float:right;" />',

    add some JS

    <script type="text/javascript"> 	
    	$("#next, #done").click(function(e) {
    		$("<input />").attr("type", "hidden")
    			.attr("name", "acf[submittype]")

    I also add some code on functions.php

    add_action('acf/submit_form', 'my_acf_submit_form', 10, 2);
    function my_acf_submit_form( $form, $post_id ) {
    	if ($_POST['acf']['submittype'] == 'next') {
    		wp_redirect( 'first_link');
    	} else {
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.