Words problem in Javascript

Go down

Solved Words problem in Javascript

Post by Winging on November 21st 2020, 9:26 am

Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
Forum link : https://ekin-ek.666forum.com/

- - - - - - - - -

If I use this code,the navigation bar will disappear.(And,close code,it will recover.)

→In the topics:Limiting the number of words has no effect.
→In all the pages:Can limit the number of words, but the mobile navigation bar will disappear.


I don't know why. Neutral

【From https://help.forumotion.com/t121475-minimum-character-post?highlight=minimum+characters

Code:
$(function() {
var x=document.forms['post'];
$(x.post).click(function(e) {
 if (x.message.value.length < 10) {
  e.preventDefault();
  alert('Your post must contain at least 10 character');
 }
});
});

Words problem in Javascript A13


Last edited by Winging on November 23rd 2020, 2:00 pm; edited 2 times in total
Winging
Winging
New Member

Posts : 21
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by skouliki on November 21st 2020, 9:48 am

skouliki
skouliki
Manager
Manager

Female Posts : 10055
Reputation : 1282
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Words problem in Javascript

Post by Winging on November 21st 2020, 11:03 am


thank you for your reply @skouliki

I try,and I find it can't count words in chinese.

Is it because Chinese belongs to Pinyin?

Even if my word count reaches the limit target (at least 5 words),【green】
Still did not count any 1 word.【red】

Words problem in Javascript Yz11
Winging
Winging
New Member

Posts : 21
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by skouliki on November 21st 2020, 5:09 pm

may i ask...is your forum language set in Chinese as well ? from the admin panel
skouliki
skouliki
Manager
Manager

Female Posts : 10055
Reputation : 1282
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

TonnyKamper likes this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by Winging on November 23rd 2020, 8:34 am

@skouliki wrote:may i ask...is your forum language set in Chinese as well ? from the admin panel
Yes,it is in chinese set.
And,I just found out recently.
I have to switch editing mode(in Code mode),it can calculate.(Some times)
Is this normal?

Thank your reply @skouliki
Winging
Winging
New Member

Posts : 21
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by SarkZKalie on November 23rd 2020, 9:11 am

A word should be more than 3 characters, i.e Hello


Words problem in Javascript Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1212
Reputation : 198
Language : English

View user profile https://rotavn.forumotion.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by skouliki on November 23rd 2020, 9:24 am

i really dont know why the code is not working properly with Chinese but i will tag my friend @pedxz he is a good coder and he might help you with this
skouliki
skouliki
Manager
Manager

Female Posts : 10055
Reputation : 1282
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

pedxz likes this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by pedxz on November 23rd 2020, 1:35 pm

Hello @Winging!

In the code find:
Code:
var regex = new RegExp('\\w{' + LetterCountPerWord + ',}\\b', 'g');
replace to:
Code:
var regex = /[^\x00-\xff]/g;
pedxz
pedxz
Forumember

Other / Decline to state Posts : 393
Reputation : 104
Language : 🇵🇹

View user profile https://www.forumotion.com/create-forum/modernbb

TonnyKamper likes this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by Winging on November 23rd 2020, 1:57 pm

@pedxz wrote:Hello @Winging!

In the code find:
Code:
var regex = new RegExp('\\w{' + LetterCountPerWord + ',}\\b', 'g');
replace to:
Code:
var regex = /[^\x00-\xff]/g;
wow! Thank @pedxz

This can work,and solved my problem.

You are very smart!!!

Thank you very much.

And I am also grateful @skouliki @SarkZKalie very much.

You are very friendly. Very Happy

(And I will mark solved Smile )
Winging
Winging
New Member

Posts : 21
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

SarkZKalie and pedxz like this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by TheCrow on November 23rd 2020, 2:11 pm

Thank you @pedxz,

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
TheCrow
TheCrow
Manager
Manager

Male Posts : 6486
Reputation : 751
Language : Greek, English

View user profile https://forumote.forumotion.com

pedxz likes this post

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum