Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 121 through 135 (of 221 total)
  • Author
    Posts
  • Nicholas CoxNicholas Cox
    Participant

    Thanks for confirming this, I can see that metabox is not the issue now that i know about the validation error, I had the metabox form inside a popup which closes (css display:none) when the form is submitted, i did not realise when the validation message was hidden that this was causing the issue as metabox could not find the hidden conformation div.

    thanks

    in reply to: Custom Table Values - Not Saving To The Custom Tables #38110
    Nicholas CoxNicholas Cox
    Participant

    Hi

    I had some time this morning and somehow I figured out what the issue seems to be. When i have more than one metabox targeting the same post type it fails to update or create new entries. This is only and issue in the latest version of MB Custom Table Addon (v2.1.2)

    'post_types' => 'product'

    e.g.

    add_filter( 'rwmb_meta_boxes', 'dc_product_register_meta_boxes' );
    function dc_product_register_meta_boxes( $meta_boxes ) {
    	
    	global $wpdb;
    
    	$meta_boxes[] = [
    		'title'   => 'Products',
    		'post_types' => 'product', // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    		'storage_type' => 'custom_table',
    		'table'        => $wpdb->prefix . 'dc_products',
    		'id'      => 'dc-product', 
    		'context' => 'normal',
    		'fields'  => [
    			[
    				'type'  => 'select',
    				'name'  => 'Type', //label for form
    				'id'    => 'type', //mysql table col
    				'options' => array(
    					'gift' => 'Gift',
    					'ask' => 'Ask',
    				),
    				'multiple' => false,
    				'placeholder' => "",
    				'select_all_none' => false,
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Title', //label for form
    				'id'    => 'post_title', //stored in wp 'post title'
    				'class' => 'dc-post-title',
    				//'placeholder' => 'e.g. Wardrobe',
    				'limit' => 50, //default character length
    				//'limit type' => 'word', //change to word count instead of character
    				'required' => true,
    				//'save_field' => false 
    			],
    			[
    				'type'  => 'textarea',
    				'name'  => 'Description', //label for form
    				'id'    => 'description', //mysql table col
    				'required' => true,
    			],
    			// [
    				// 'type'       => 'dc_flatpickr_calendar',
    				// 'name'       => 'Start Date', //label for form
    				// 'id'         => 'start_date', //mysql table col
    				// 'attributes' => [ //my custom attributes
    					// 'altInput'  	=> true,
    					// 'altFormat' 	=> 'd-m-Y',
    					// 'inline'  	=> false,
    					// 'allowInput'	=> false,
    					// 'disableMobile' => false,
    				// ],
    				// 'required' => true,
    			// ],
    			[
    				'type'      => 'dc_flatpickr_calendar',
    				'name'      => 'End Date (optional)', //label for form
    				'id'        => 'end_date', //mysql table col
    				'attributes' => [ //my custom attributes
    					'altInput'  	=> true,
    					'altFormat' 	=> 'd-m-Y H:i',
    					'inline'  		=> false,
    					'allowInput'	=> false,
    					'disableMobile' => false,
    					'minDate' 		=> 'today',
    					'enableTime' 	=> false,
    					'time_24hr' 	=> false,
    					'enableSeconds' => false,
    					'defaultHour' 	=> 0,
    				],
    				//'required' => true,
    			],
    			// [
    				// 'type'  => 'number',
    				// 'name'  => 'Price', //label for form
    				// 'id'    => 'price', //mysql table col
    				// 'step'  => '.01', //two decimal places e.g. 0.00
    				// 'placeholder'  => '0.00',
    				// 'required' => true,
    			// ],
    			[
    				'type'  => 'select',
    				'name'  => 'Condition', //label for form
    				'id'    => 'condition', //mysql table col
    				'options' => array(
    					'used' => 'Used',
    					'like new' => 'Like New',
    					'new' => 'New',
    				),
    				'multiple' => false,
    				'placeholder' => "",
    				'select_all_none' => false,
    				'required' => true,
    			],
    			[
    				'type'  => 'select',
    				'name'  => 'Location', //label for form
    				'id'    => 'location', //mysql table col
    				'options' => array(
    					'Hucknall' => 'Hucknall',
    				),
    				'multiple' => false,
    				'placeholder' => "",
    				'select_all_none' => false,
    				'required' => true,
    			],
    		],
    	];
    
    	return $meta_boxes;
    }
    
    add_filter( 'rwmb_meta_boxes', 'dc_product_deletion_register_meta_boxes' );
    function dc_product_deletion_register_meta_boxes( $meta_boxes ) {
    	
    	global $wpdb;
    
    	$meta_boxes[] = [
    		'title'   => 'Test',
    		'post_types' => 'product', // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    		'storage_type' => 'custom_table', 
    		'table'        => $wpdb->prefix . 'dc_test', 
    		'id'      => 'dc-product-test',
    		'context' => 'normal',
    		'fields'  => [
    			[
    				'type'  => 'textarea',
    				'name'  => 'Test', //label for form
    				'id'    => 'test', //mysql table col
    				'required' => true,
    			],
    		],
    	];
    
    	return $meta_boxes;
    }

    also i noticed the same issue happens when targeting
    'type' => 'user'

    e.g.

    add_filter( 'rwmb_meta_boxes', 'dc_users_register_meta_boxes' );
    function dc_users_register_meta_boxes( $meta_boxes ) {
    	
    	global $wpdb;
    
    	$meta_boxes[] = [
    		'title'   => '',
    		'type' => 'user', //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    		'storage_type' => 'custom_table', 
    		'table'        => $wpdb->prefix . 'dc_users', // custom table name
    		'id'      => 'dc-user-register', //metabox id
    		'context' => 'normal',
    		'fields'  => [
    			[
    				'type'  => 'text',
    				'name'  => 'First Name', //label for form
    				'id'    => 'first_name', //mysql name (custom table)
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Last Name', //label for form
    				'id'    => 'last_name', //mysql name (custom table)
    				'required' => true,
    			],
    			[
    				'name'     => 'Email',
    				'id'       => 'user_email', //REQUIRED (default WP field)
    				'type'     => 'email',
    				'required' => true,
    			],
    			[
    				'name'     => 'Password',
    				'id'       => 'user_pass', //REQUIRED (default WP field)
    				'type'     => 'dc_password_strength_checker',
    				'required' => true,
    				'attributes' => [
    					'minCharacters' => 8, //min password length
    					'lowerUpperCase' => true, //contain lower & uppercase
    					'numbers' => true, //contain numbers
    					'specialCharacters' => false, //contain special characters
    				],
    			],
    			// [
    				// 'name'     => 'Password',
    				// 'id'       => 'user_pass', //REQUIRED (default WP field)
    				// 'type'     => 'password',
    				// 'required' => true,
    				// 'desc'     => '<span id="password-strength" class="rwmb-password-strength"></span>',
    				// 'attributes' => [
    					// 'autocomplete' => 'new-password' //browser suggest a strong password
    				// ],
    			// ],
    			// [
    				// 'name'     => 'Confirm Password',
    				// 'id'       => 'user_pass2', //REQUIRED (default WP field)
    				// 'type'     => 'password',
    				// 'required' => true,
    				// 'attributes' => [
    					// 'autocomplete' => 'new-password' //browser suggest a strong password
    				// ],
    			// ],
    		],
    	];
    
    	return $meta_boxes;
    }
    
    add_filter( 'rwmb_meta_boxes', 'dc_users_profile_meta_boxes' );
    
    function dc_users_profile_meta_boxes( $meta_boxes ) {
    	
    	global $wpdb;
    
    	$meta_boxes[] = [
    		'title'   => 'Edit Profile', 
    		'type' => 'user', //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    		'storage_type' => 'custom_table', 
    		'table'        => $wpdb->prefix . 'dc_users', 
    		'id'      => 'dc-user', 
    		'context' => 'normal',
    		'fields'  => [
    			[
    				'type'  => 'text',
    				'name'  => 'First Name', //label for form
    				'id'    => 'first_name', //mysql name (default user field in user table)
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Last Name', //label for form
    				'id'    => 'last_name', //mysql name (default user field in user table)
    				'required' => true,
    			],
    			[
    				'type' 	=> 'email',
    				'name'  => 'Email',
    				'id'   	=> 'user_email', //target defaut wp metaname
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Address', //label for form 
    				'id'    => 'address', //mysql name
    				//'placeholder'    => 'e.g. 10 Bond Street',
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'City', //label for form 
    				'id'    => 'city', //mysql name
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Town', //label for form
    				'id'    => 'town', //mysql name
    				'required' => true,
    			],
    			[
    				'type'  => 'text',
    				'name'  => 'Postcode', //label for form
    				'id'    => 'postcode', //mysql name
    				'required' => true,
    			],
    			[
    				'name'     => 'Country', //label for form
    				'id'       => 'country', //mysql name
    				'type'     => 'hidden', //set to hidden as not used
    				'std'	   => 'United Kingdom', //set default value to UK (as no plans to expand beyond the uk)
    			],
    			[
    				'type' 	=> 'dc_image_to_base64', //type of field (metabox ones or custom)
    				'name' 	=> 'Profile Image', //label for form
    				'id'   	=> 'image', //mysql table name
    				'attributes' => [ 
    					'max'  => 1, //max of 10 files
    					'buttonlabel'  => 'upload',
    					'maxWidth'  => 300, //px
    					'maxHeight' => 300, //px
    					//'maxFileSize'  => 8000000', //default wp upload size
    				],
    				'saveToCustomFolder' => [ 
    					'enabled'  => true, //enable folder save (default false)
    					'folder'  => 'profile', //foldername no slashes
    					'deleteOnUpdate'  => true, //force deletetion of images uploaded before
    				],
    				'required' => true,
    			],
    		],
    	];
    
    	return $meta_boxes;
    }
    
    in reply to: Custom Table Values - Not Saving To The Custom Tables #38096
    Nicholas CoxNicholas Cox
    Participant

    also when i go to edit a post using the same shortcode and populating the if from the url e.g. http://192.168.0.14/stagingsite/edit-product/?rwmb_frontend_field_post_id=387

    The values are loaded correctly (so its reading from the custom database table ok), just not updating it when the form is submitted.

    in reply to: Custom Table Values - Not Saving To The Custom Tables #38095
    Nicholas CoxNicholas Cox
    Participant

    Hi, ok when you say a new field group, are you on about adding in a 'metabox group'? https://docs.metabox.io/extensions/meta-box-group/

    in reply to: Front End Forms inside Gutenberg Block Render Template #38089
    Nicholas CoxNicholas Cox
    Participant

    Hi, ok no problem. I wanted to be able to preview the form in the backend, not load the enqueued scripts. The reason being is that the block just loads a form and a title, without it there is a blank/empty block. I will have to think of a way around it then.

    thanks

    in reply to: Setting Multiple Blocks To False Not Working #38057
    Nicholas CoxNicholas Cox
    Participant

    ah ok my bad, i missed the part on this, thanks for clearing this up.

    in reply to: Ajax Form Re-submission and Invalid Error Message #38042
    Nicholas CoxNicholas Cox
    Participant

    Hi Long,

    ok thanks for the update

    in reply to: Ajax Form Re-submission and Invalid Error Message #37982
    Nicholas CoxNicholas Cox
    Participant

    Hi, thanks and will this be included in the next update?

    in reply to: Populate forms with JS #36650
    Nicholas CoxNicholas Cox
    Participant

    Hi, Is it possible for you provide me with an example please?

    in reply to: Embed form inside iframe externally #36447
    Nicholas CoxNicholas Cox
    Participant

    Hi

    sorry i think i did not explain myself clearly. I do not understand this guide https://docs.metabox.io/extensions/mb-frontend-submission/#embedding-forms-on-other-sites-via-iframe as i thought there would be an example of a iframe tag pointing to a page with an embedded form?

    I thought about creating a blank page with the front end form, but if i try to include the shortcode in a php file it renders the form but with no js/css.
    e.g.

    require_once( '../../../../../../wp-load.php' );
    echo do_shortcode('[mb_frontend_form id="dc-product-comments" submit_button="Submit" ajax="true"]');

    Or event if I create a hidden wordpress page and include the front end form shortcode then i end up outputting header/footer content too, which i do not want.

    in reply to: Embed form inside iframe externally #36426
    Nicholas CoxNicholas Cox
    Participant

    Ok thanks. There is no example of the iframe element so i assume that the form has to be outputted on a webpage and embed the whole webpage inside the iframe?

    Is there a way just to output the form only inside a iframe with required css/js?

    Thanks

    in reply to: Populate forms with JS #36268
    Nicholas CoxNicholas Cox
    Participant

    Ok thanks. That might work. What shall i target with wp_remote_get() ? I am not quite sure how to grab the metabox config from a post id.

    in reply to: Cloning form and event handlers #36086
    Nicholas CoxNicholas Cox
    Participant

    Hi Long,

    Ok thanks for clarifying. I can work around this with the custom fields trigger events.

    Thanks

    in reply to: Front End Submission and Custom Models #35410
    Nicholas CoxNicholas Cox
    Participant

    👍

    Nicholas CoxNicholas Cox
    Participant

    Hi

    Thanks for looking into this. I have tested this and can confirm the issue has been fixed! I have tested a few forms and so far there has been no issues.

    Thanks

Viewing 15 posts - 121 through 135 (of 221 total)