Tell us what you are trying to do?
have a form with a select field where i need to control which options is visible.
the Select options must be conditional set so if a condition for a select option is false this option will not be in the select box
Can i do it in toolset or in php?
toolset:
add_action('cred_save_data', 'after_save_data_for_form',30,2);
function after_save_data_for_form($post_id, $form_data)
{
//some code here
switch($form_data['id']) {
case 236:
global $wpdb;
//some code here
break;
default:
//code to be executed if n is different from all labels;
}
}
Is there a similar example that we can see?
i do not have a working example but would like to use the php example above with form id 236 if possible
What is the link to your site?
There are no API filters available where you can modify the options included in a select field inserted in a form.
The only option would be to use JavaScript to remove the options you don't want to include in the browser.
The question then is how is it determined which options should be removed?
If there is some test that you perform when the page is being built on the server then you would need to add some PHP that checked you were on the right page, performed your test, then created an array of the options that should be excluded, then made that same array available on the front end using the WP function wp_localize_script, which your custom JS would then use to modify the select input in the DOM, removing the unwanted options.