Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 221 total)
  • Author
    Posts
  • in reply to: dynamic model form population error #47751
    Nicholas CoxNicholas Cox
    Participant

    when setting the max_clone to 2 or more this is not an issue with auto populating forms, just when its set to 1.

    in reply to: dynamic model form population error #47750
    Nicholas CoxNicholas Cox
    Participant

    Hi, i have checked this over and recreated a new one and the problem has gone away but the issue still persisted with the population of the form using the url param ?rwmb_frontend_field_object_id=1

    I started to remove the settings in the form back and noticed the following setting for max_clone is causing the issue to populate groups from serialized arrays.

    'max_clone' => 1

    if i remove this then i can auto populate the form correctly and also successfully update the entry using the shortcode.

    So i assumed the form was not auto populating as my form only contains a group field. All other fields populate correctly.

    Any ideas why the max_clone of 1 is not working?

    in reply to: dynamic model form population error #47748
    Nicholas CoxNicholas Cox
    Participant

    yes i add more entries and then try to edit them and i receive the same warning about capability.

    Ok ill setup a test site, but before here is the code im using incase im missing something.

    public function paymentGatewayFormFields( $meta_boxes ) {
    	
    	global $wpdb;
    
    	$meta_boxes[] = [
    		'title' => 'Payment Gateways',
    		'models' => [self::$paymentGatewayClientsModel],
    		'storage_type' => 'custom_table', 
    		'table'        => $wpdb->prefix . self::$paymentGatewayClientsTable,
    		'id'      => self::$metaboxFormId, 
    		'fields'  => [
    			[
    				'id'   => 'user_id',
    				'type' => 'hidden',
    				'std'  => get_current_user_id() ?? 0,
    			],
    			[
    				'type' => 'group',
    				'id'   => 'data',
    				'name' => 'Payment Gateways',
    				'group_title' => 'Payment Gateways',
    				'clone' => false,
    				'collapsible' => false,
    				'default_state' => 'collapsed',
    				'save_state' => false,
    				'save_field' => true,
    				'fields' => [
    					[
    						'type' => 'group',
    						'id'   => 'stripe',
    						'name' => 'Stripe Accounts',
    						'group_title' => 'Stripe',
    						'clone' => true,
    						'max_clone' => 1,		
    						'min_clone' => 0,				
    						'collapsible' => false,
    						'default_state' => 'expanded',
    						'save_state' => false,
    						'clone_empty_start' => true,
    						'add_button' => '+ Add Stripe',
    						'fields' => [
    							[
    								'id'   => 'id', //mysql table col
    								'type' => 'hidden',
    								'std'  => DripCreatePlatformHelper::generateRandomKeyByLength( 7 ),
    							],
    							[
    								'type'  => 'text',
    								'name'  => 'Domain', 
    								'id'    => 'domain', 
    								'required' => false,
    								'columns' => 4, 
    							],
    							[
    								'type'  => 'text',
    								'name'  => 'live Secret Key', 
    								'id'    => 'live_secret_key', 
    								'required' => false,
    								'columns' => 3, 
    							],
    							[
    								'type'  => 'text',
    								'name'  => 'Webhook Secret',
    								'id'    => 'live_webhook_secret',
    								//'limit' => 10,
    								'required' => false,
    								'columns' => 3,
    							],
    							[
    								'type'      => 'switch',
    								'name'      => 'Enabled',
    								'id'        => 'enabled',
    								'style'     => 'rounded',
    								'on_label'  => 'Yes',
    								'off_label' => 'No',
    								'std' 		=> 1,
    								'columns' => 2,
    							],
    						],
    					],
    				],	
    			],	
    		],
    	];
    	
    	return $meta_boxes;
    }
    in reply to: dynamic model form population error #47740
    Nicholas CoxNicholas Cox
    Participant

    Hi Peter,

    Sorry for the delay, was away. I have done a screen recording showing im signed in as an administrator who posted the entry and with one result in the model database table, the shortcode and the test page.

    Video Link

    thanks

    Nick

    in reply to: Models and Auto Increment ID issue #47596
    Nicholas CoxNicholas Cox
    Participant

    Hi Peter,

    Ok that makes sense now, I have set the object_type to model and tested an all working ok now. Many thanks

    in reply to: Models and Auto Increment ID issue #47575
    Nicholas CoxNicholas Cox
    Participant

    Hi,

    I will get a screen recording, but before i do I thought I read somewhere that I can use front end forms with custom models and custom tables now (but cannot find the information), as i posted this a few years ago https://support.metabox.io/topic/front-end-submission-and-custom-models/ which said that this was not supported. Can you confirm if custom models works with front end submission now? as i believe this is the reason why its not working.

    thanks

    in reply to: Models and Auto Increment ID issue #47511
    Nicholas CoxNicholas Cox
    Participant

    So I have over 800 wordpress posts and when I insert the first row into a model table the ID is set to e.g. 806. Its weird behaviour not to be how metabox inserts new row values into custom model tables

    in reply to: Models and Auto Increment ID issue #47510
    Nicholas CoxNicholas Cox
    Participant

    Hi. Yes try adding a few default wordpress posts first and then try adding a row to the custom models database table. As I'm not sure if your test environment matches to replicate my issue? If not then no worries.

    What your describing is normal behaviour in regards to deleting the first databass table entry and adding a new entry which assigns an id of 2 etc... mysql tables behave like this with auto increment columns.

    My theory is that metabox is using some logic with posts which is causing the issue. As I have tested manually by inserting a new value and it works as intended with the first row having an id of 1.

    Any ideas? Thanks

    in reply to: Form data and post size limit #47489
    Nicholas CoxNicholas Cox
    Participant

    yes i was just checking as the form keeping loading for a long time and never times out or displays and error message if the post_max_size etc is exceeded. How do we handle these scenarios using front end forms? is there a way to auto fail validation? thanks

    Nicholas CoxNicholas Cox
    Participant

    Hi yes but when validating using rwmb_frontend_validate you have to do additional checks to see if the first value is empty or not also if the clone max is set to 1 then the array is no longer a nested array which means another check to see if its a single array or nested array.

    I was just checking with you as there is inconsistencies in the array returned when different settings are enabled and disabled, there is no guide on metabox validation array checks in the docs and what to look out for.

    thanks

    Nick

    in reply to: Models and Auto Increment ID issue #47487
    Nicholas CoxNicholas Cox
    Participant

    Yes it seems it takes the next available wordpress post ID and not the next available ID of the custom model database table.

    in reply to: Models and Auto Increment ID issue #47472
    Nicholas CoxNicholas Cox
    Participant

    ignore the first code as this was just an example and not the correct code, but the issue still persists with the form code being correct to that of the table structure, i cannot edit my first post.

    in reply to: clone_empty_start not working #47322
    Nicholas CoxNicholas Cox
    Participant

    Hi Peter,

    I did some investigation and turns out this CSS call I had in my custom CSS file (not metabox related) was causing the issue. So once I removed this all is working as it should.

    .rwmb-form .rwmb-clone.rwmb-clone-template {
      display: inherit;
    }
    Nicholas CoxNicholas Cox
    Participant

    Hi,

    I did some investigation and turns out i had some JS issues which was affecting the form and not related to metabox scripts. So thanks anyway, i find it hard sometimes to debug JS errors.

    To confirm the save_state works as it should.

    in reply to: Form data and post size limit #47260
    Nicholas CoxNicholas Cox
    Participant

    Hi

    Its a custom field, its basically a file upload which converts it to a base64 string. Then the idea being when they submit the form i process the base64 image and then save a image path when validating.

    I was asking about the POST size as i am not uploading the files before the form is submitted the PHP post size is increased. I just wondered if there is a limit to what can be sent with metabox? or is this dependent upon the server setup?

Viewing 15 posts - 16 through 30 (of 221 total)