Support

Account

Home Forums Feature Requests Feature Request: Hidden / Disabled Field Type Reply To: Feature Request: Hidden / Disabled Field Type

  • A solution to set hidden/disabled attribute on a regular field would be helpful when creating front-end forms for submitting data.

    Example:

    Filling an inquiry form for a product, the populated acf_form in the front end can grab current ID from product page and pre fill an ACF Post Object type with it’s current ID.

    Maybe this settings can be available in the acf_form() options arguments when populating the form or via load_field/name={$fieldname} filter

    Somthing like:

    
    
    add_filter('acf/load_field/name=property','wc_set_field');
    function wc_set_field($field){
    		
    		if( !is_admin() && is_single() ){
    			$pid = get_the_ID();
    			$field['default_value'] = $pid;
    			$field['disabled'] = true;
    			$field['hidden'] = true;
    		}
    
    		//same in, same out
    		return $field;	
    }
    

    This way the field value is blocked in the frontend but it can be changed using the regular backend edit screen normally without changing its field type.

    I see myself using ACF a lot to solve front end forms. This feature can help create relations easier.

    Thanks for the great work on ACF.