Support

Account

Home Forums Front-end Issues Front End Form Submitting – Not Working Correctly

Solved

Front End Form Submitting – Not Working Correctly

  • Hello,

    Ive followed this http://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/

    and it works, kind of.

    The only problems i have is when you submit, the field i have for the title doesnt get set as the title. In the script on the page its this part

    'post_title' => '$_POST' ,

    But all that happens is $_POST is set as it (as i would assume it to be) how can i get it so my title field sets the post title?

    Is it possible to have a field where by they can set the category ? i know you can have it so the user can select the category but id like it so they can set it themselves. same goes for the tags….

    Lastly when i submit the form it directs it to

    xxxxxx.com/hello-world/?updated=true&post_id=105

    but im using the form at /upload/, how can i get it so it doesnt redirect to hello-world/ bla bla bla and just uploads on the /upload/

    Help would be greatly appreciated, i cant find any solutions and ive been at this for the best part of a day.

    Kind Regards
    Thomas

    p.s i forgot to mention is there away to have just an upload field and NOT show the wordpress media library?

  • Hi @renshaw

    For the post title, you can set the post_title option to true so that acf_form() shows the post title text field

    For the category and tags, you could provide a way for the user to input the category/tag then use AJAX to update the new entry on the backend and frontend.

    For the redirect URL, use the return option to specify the redirect URL upon submission of the form.

    Check out the following more info:
    http://www.advancedcustomfields.com/resources/acf_form/

  • Hi, this all works great, 1 thing though… How do I overwrite the error page if a field was missed. ie: instead show the fields highlighted rather than have the floating page: Here is an example.

    This is the error screen I get

  • do you have this placed before your header?
    acf_form_head();

    it should validate via javascript.

  • Indeed I do. After I submit the form, the screen I posted above is the one I get. Here is the code I use:

    <?php
    /**
     * Template Name: Home Page
     *
     */
    acf_form_head();
    get_header(); ?>
    
    <?php 
    	
     acf_form(array(
    	'post_id' => 'new_post',
    	'post_title' => true,
    	'new_post' => array(
    		'post_type' => 'nf_slider',
    		'post_status' => 'draft'
    	),
    	'submit_value' => 'Create Slider'
    ));
    ?>
    
    <?php get_footer(); ?>
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Front End Form Submitting – Not Working Correctly’ is closed to new replies.