How could i limit only input english character and number at SKU field?

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM How could i limit only input english character and number at SKU field?

Viewing 5 reply threads
  • Author
    Posts
    • #37133
      MOHO
      Participant

      My some user will input chinese word…
      so i want to limit only input english character and number at this SKU field.

      If the user input not english character and number, could display error message?

      Attachments:
      You must be logged in to view attached files.
    • #37198
      WCFM Forum
      Keymaster

      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

    • #37256
      MOHO
      Participant

      i also could input chinese in SKU field

    • #37300
      WCFM Forum
      Keymaster

      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

    • #37335
      MOHO
      Participant

      Do you know this numbers for Chinese characters?
      What do you mean?

      so each number is a chinese word?

    • #37338
      WCFM Forum
      Keymaster

      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

Viewing 5 reply threads
  • The topic ‘How could i limit only input english character and number at SKU field?’ is closed to new replies.