Numeric only text field lets letters through
-
Following the instructions here https://github.com/WebDevStudios/CMB2/wiki/Tips-&-Tricks#limit-text-field-to-numbers-only
I’ve set a text field to numeric, but when testing, I typed in letters instead of numbers and they were allowed through.
$cmb->add_field( array(
‘name’ => __( ‘price for 1 license’, wds-post-submit ),
‘id’ => $prefix . ‘price_for_1_license’,
‘type’ => ‘text’,
‘type’ => ‘number’,
‘attributes’ => array(
‘type’ => ‘number’,
‘pattern’ => ‘\d*’,
),
) );And here is the result: price_for_1_license is “aaaaaaa”, even though it should not allow letters. Unless it works with hex numbers? ??
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Numeric only text field lets letters through’ is closed to new replies.