The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Words problem in Javascript

5 posters

Go down

Solved Words problem in Javascript

Post by Winging 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
Forumember

Female Posts : 149
Reputation : 4
Language : traditional chinese

https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

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

skouliki
skouliki
Manager
Manager

Female Posts : 15397
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Words problem in Javascript

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

skouliki wrote:hello

the code is old maybe you want to try this one https://help.forumotion.com/t131191-add-a-word-counter-to-the-editor?highlight=editor+limit

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
Forumember

Female Posts : 149
Reputation : 4
Language : traditional chinese

https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by skouliki 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 : 15397
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

TonnyKamper likes this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by Winging 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
Forumember

Female Posts : 149
Reputation : 4
Language : traditional chinese

https://ekin-ek.666forum.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by SarkZKalie 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 : 1446
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Solved Re: Words problem in Javascript

Post by skouliki 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 : 15397
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

tikky likes this post

Back to top Go down

Solved Re: Words problem in Javascript

Post by tikky 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;
tikky
tikky
Forumember

Posts : 923
Reputation : 160
Language : 🇵🇹

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 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
Forumember

Female Posts : 149
Reputation : 4
Language : traditional chinese

https://ekin-ek.666forum.com/

SarkZKalie and tikky like this post

Back to top Go down

Solved Re: Words problem in Javascript

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

Thank you @pedxz,

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


Words problem in Javascript Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

tikky likes this post

Back to top Go down

Back to top

- Similar topics

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