Ok ran some more tests and fixed this one up, however it led to more questions 🙂
here is the working version in case anyone is interested and ill start another ticket for the other questions - its related but probably worth its own ticket as it related to saving the option value and the option label into the taxonomy...
In the CRED edit form:
[code]
[cred_generic_field type='multiselect' field='test' class='partner-service-industries']
{
"required":0,
"persist":1,
"default":[[wpv-view name="test-tax"]],
"options":[[wpv-view name="partner-industries-select"]]
}
[/cred_generic_field]
[/code]
In the code snippets section:
[code]
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==386143)
{
if (isset($_POST['test']))
{
wp_set_object_terms( $post_id, $_POST['test'], 'test', False );
}
}
}
[/code]
EXTRA Note: the default option on the generic custom field here which allows the cred form refresh to show all the generic multi-select values need to be formatted in a particular way:
Ensure you select the correct taxonomy, and untick the query options " Don't show empty terms" (no idea why you need to).
Also, in the query filter, ensure this: Taxonomy is set by the page where this View is inserted
(and make sure: Disable the wrapping DIV around the View )
In the view loop editor - do this:
[code]
<wpv-loop>
[wpv-item index=1]
"[wpv-taxonomy-slug]"
[wpv-item index=other],"[wpv-taxonomy-slug]"
</wpv-loop>
[/code]