Hi everyone,
I looked into this and built a small fix you can add to your site. No need to edit the plugin files, so it will keep working after updates.
In version 3.14.9 Ninja Forms added a security check for list and radio fields. Now when a form is submitted, it checks the chosen value against the saved options list.
The problem is that this check uses the options saved in the database. It does not run the ninja_forms_render_options filter, which is the one most of us use to fill the list on the fly (for example from posts, a custom post type, or an API).
So the user sees the option in the dropdown and picks it, but on submit the value is not in the saved list, and Ninja Forms says “Invalid selection.” The hidden fields also come back because the form did not finish.
Rolling back to 3.14.8 works because that check did not exist before.
We can use the ninja_forms_pre_validate_field_settings hook to run the same render filter on the validation side too. This way the check sees the same options the user saw. The security check stays in place, only real options pass. It touches only the listselect and listradio fields.
Create a file at wp-content/mu-plugins/nf-3149-invalid-selection-fix.php and paste this inside:
<?php
/**
* Plugin Name: Ninja Forms 3.14.9+ "Invalid selection" Fix
* Description: Makes dynamically-populated listselect/listradio options pass validation again after the 3.14.9 option-whitelist change. No core file edits; survives plugin updates.
* Version: 1.0.0
* Author: Faisal Ahammad
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter( 'ninja_forms_pre_validate_field_settings', 'nf_3149_fix_render_options_at_validation' );
function nf_3149_fix_render_options_at_validation( $field ) {
if ( ! isset( $field['type'] ) ) {
return $field;
}
if ( 'listselect' !== $field['type'] && 'listradio' !== $field['type'] ) {
return $field;
}
if ( ! isset( $field['options'] ) || ! is_array( $field['options'] ) ) {
return $field;
}
$field['options'] = apply_filters( 'ninja_forms_render_options', $field['options'], $field );
$field['options'] = apply_filters( 'ninja_forms_render_options_' . $field['type'], $field['options'], $field );
return $field;
}
If you prefer, you can also paste the function part into your child theme functions.php or a small custom plugin. Just do not edit files inside the ninja-forms folder, those get overwritten on update.
Give it a try, and let me know how that goes!
Best regards,
Faisal (forum volunteer)