Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › How could i limit only input english character and number at SKU field?
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by WCFM Forum.
- AuthorPosts
- November 19, 2018 at 8:50 pm #37133
- November 20, 2018 at 9:27 am #37198WCFM ForumMember
Hi,
Please add this code snippet for the purpose –
add_action( 'after_wcfm_products_manage', function() { ?> <script> jQuery(document).ready(function($) { $('#sku').on('keydown', function( event ) { var key = event.keyCode; return ((key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 96 && key <= 105) || key == 8 || key == 189 || key == 9 || key == 32 || key == 107 || key == 109 ); }); }); </script> <?php });
Thank You
- November 20, 2018 at 12:54 pm #37256MOHOParticipant
i also could input chinese in SKU field
- November 20, 2018 at 4:57 pm #37300WCFM ForumMember
HI,
Check this code –
add_action( ‘after_wcfm_products_manage’, function() {
?>
= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 96 && key <= 105) || key == 8 || key == 189 || key == 9 || key == 32 || key == 107 || key == 109 ); Do you know this numbers for Chinese characters? then please know me those. Thank You - November 20, 2018 at 8:34 pm #37335MOHOParticipant
Do you know this numbers for Chinese characters?
What do you mean?so each number is a chinese word?
- November 20, 2018 at 8:38 pm #37338WCFM ForumMember
Hi,
Look this –
(key >= 48 && key < = 57) - 48-57 are integer's key board numbers (key >= 65 && key < = 90) - 65-90 are English character's key board numbers I have to know Chinese key board numbers, so that I can setup this rule for Chinese characters.
add_action( 'after_wcfm_products_manage', function() { ?> <script> jQuery(document).ready(function($) { $('#sku').on('keydown', function( event ) { var key = event.keyCode; alert(key); return ((key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 96 && key <= 105) || key == 8 || key == 189 || key == 9 || key == 32 || key == 107 || key == 109 ); }); }); </script> <?php });
I have modified this code a bit, now you will get a popup for each keypress, this will you to know Chinese characters key numbers.
Know me those.Thank You
- AuthorPosts
- The topic ‘How could i limit only input english character and number at SKU field?’ is closed to new replies.