Hi again,
To set the increment of value by 10 or 100 on a number field, please try using the following code.
add_action( 'after_setup_theme', 'wpmudev_fm_custom_required_fields_func', 100 );
function wpmudev_fm_custom_required_fields_func() {
if ( defined('FORMINATOR_PRO') && class_exists( 'Forminator' ) ) {
class WPMUDEV_FMCSN{
public $your_form_ids = [991];
public $number_field_ids = [
// [number_field_id] => [step]
'number-1' => 10,
'number-2' => 100
];
private $should_custom;
public function __construct(){
add_filter( 'forminator_cform_render_fields', array( $this, 'should_custom_required_field' ), 10, 2 );
add_filter( 'forminator_field_number_markup', array( $this, 'custom_number_field' ), 10, 2 );
}
public function should_custom_required_field( $wrappers, $form_id ){
if( in_array( $form_id, $this->your_form_ids ) ){
$this->should_custom = 1;
}
return $wrappers;
}
public function custom_number_field( $html, $field_id ){
if( $this->should_custom ){
$field_id = str_replace('forminator-field-', '', $field_id );
if( isset( $this->number_field_ids[ $field_id ] ) ){
$html = str_replace('name=', 'step="'. esc_attr( $this->number_field_ids[ $field_id ] ) .'" name=', $html );
}
}
return $html;
}
}
$run = new WPMUDEV_FMCSN();
}
}
Please note, you need to change the form id and number field id with the corresponding one from your form. You can add the code using a mu-plugin, please find more details here: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
I hope that helps, please feel free to get back to us if you need any further assistance.
Best Regards,
Nebu John