Support

Account

Home Forums Front-end Issues ACF_form() : simplified to a button and hard coded values

Helping

ACF_form() : simplified to a button and hard coded values

  • Hey!

    I am hoping someone can help me out.
    I suck at Javscript, so I was hoping I could just use the acf_form().

    All I want, is a simple button that when clicked, will update certain fields without giving the user the input field. I want it to be hardcoded.

    For example, one simple use case. There is a custom post type called “Installs”.
    In this custom post type, there is a custom field (ACF true/false field) that is called “Completed”

    On the front end list of all installs, I want a button that says “completed” that the user can click and then update [completed] to ‘1’.

    I can’t figure out how to do this with the current ACF Form. I can get it to display the true/false field and the button that says “Completed” but I am not sure how to do this without showing the user the true/false field. I want them to just see the ‘submit’ button.

    
    acf_form_head();
    acf_form(array(
    	'post_id' 		=> $id,
    	'fields' 		=> ['field_605b62244f4dc'],
            'post_title'    	=> false,
            'post_content'  	=> false,
    	'return' 		=> '/manufacturing/',
    	'html_submit_button'  	=> '<input type="submit" class="btn bg-blue small text-uppercase p-1 text-white" value="%s" />',
            'submit_value'  => __('Save')
        )); 
    
  • The only way I can think of to potentially do this is to set the default value of the true/false field to true and then hide the field using CSS.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.