• Resolved hariom61234

    (@hariom61234)


    Hi, I’m trying to add a multiselect custom field to my job submission form and I checked out one text field example in documentation. The text field example worked fine. But I’m facing an issue in multiselect field ……….

    I am able to select multiple values, But after the submission of the job form, selected options are not saved on the database. It just stores ‘1’.

    Also, I have used the submit_job_form_save_job_data filter hook to check submitted values. At this point, I am getting values of selected options but not able to save them in the database.

    function test_multiselect_field_frontend( $fields ) {
    	$fields['job']['test_job_borads'] = array(
    		'label'       => __( 'Test Job Borads', 'job_manager' ),
    		'type'        => 'multiselect',
    		'required'    => false,
    		'options'     => array(
    			'flipkart' => 'Flipkart',
    			'amazon'   => 'Amazon',
    			'naukri'   => 'Naukri',
    		),
    		'description' => 'Select Companies',
    		'priority'    => 14,
    	);
    	return $fields;
    }
    add_filter( 'submit_job_form_fields', 'test_multiselect_field_frontend',10,1 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hariom61234

    (@hariom61234)

    Also is it possible to have a custom multi-select checkbox field? Similar to the term-checklist field which is present by default in the job listing custom post type.

    • This reply was modified 2 years, 9 months ago by hariom61234.
    Plugin Support Jay

    (@bluejay77)

    Hi @hariom61234,

    Thanks for your interest in WP Job Manager! Please note, we do not support customizations – you can refer to our Support Policy:

    https://wpjobmanager.com/support-policy/

    Specifically:

    “We provide our products as-is. We cannot customize our products on-demand, nor can we support third-party customizations. A customization is anything that changes the way the products looks or functions relative to how we make our products available to you. We can do our best to offer advice and guidance, and direct you to the appropriate resources if you require assistance with customization, but we don’t take responsibility or endorse any third-party solutions for customized products.”

    We cannot review or debug your custom code, however, we can point you in the right direction.


    You mentioned that you’re using the submit_job_form_save_job_data filter hook to check submitted values. Are these values of the selected options in an array or string format?

    If the values are in an array, you could convert the array values into a comma separated string using that filter.

    If that doesn’t work, you can create an issue on the WPJM repository, here:

    https://github.com/Automattic/WP-Job-Manager/issues

    I hope that helps!

    Thread Starter hariom61234

    (@hariom61234)

    I understand but all I need is a simple example of a custom field where I can select multiple checkboxes values. Is it too big an ask?

    Hi @hariom61234,

    The issue is not with the code perse but how the code is saving the information to the database.

    The values from the multi-select field need to be in a _string_ format and not an array. If the values are in an array, convert the array values into a comma-separated string using the filter.

    If you need more help with this, please post an issue on our Github repo here so that the developers can take a direct look and provide feedback.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiselect fields value not saving in database’ is closed to new replies.