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.

About the number of words to reply

5 posters

Go down

In progress About the number of words to reply

Post by Winging July 18th 2021, 7:33 am

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

- - - - - - - -
I hope that the reply can be at least 10 words before posting.
But I don’t know why.
If you are using Chinese Pinyin, you can successfully pronounce it without 10 words.
This is what confuses me.

JS(In all the pages):

Code:
$(function(){$(function(){
     
      var MinNumberOfWords = 10;
      var LetterCountPerWord = 3;
      var ico_compl = "https://i.servimg.com/u/f73/18/10/89/49/ok-gre10.png";
      var ico_incompl = "https://i.servimg.com/u/f73/18/10/89/49/exclam10.png"; 
 
    if($("#text_editor_textarea").length ! = 0){
          $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");     
          $(".sceditor-container").after("<br/><div id='div_minchars' align='center'><div id='div_minchars_header'> 回 帖 最 少 字 数: " + MinNumberOfWords + " (at least " + LetterCountPerWord + " letters)</div><div id='div_minchars_info'></div></div>");
         
          var sceditor = $("#text_editor_textarea").sceditor("instance");                 
          var str = sceditor.val();
          var regex = /[^\x00-\xff]/g;
          var str_arr = str.match(regex);
          var str_len = str_arr == null ? 0 : str_arr.length;
           
             
          if(str_len >= MinNumberOfWords) $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
             
     
          sceditor.keyUp(function(e) {
            str = sceditor.val();
            str_arr = str.match(regex);
            str_len = str_arr == null ? 0 : str_arr.length;
            if(str_len >= MinNumberOfWords) {
                $("#div_minchars_info").html("You've written <span style='color:green'>" + str_len + "</span> word(s). You can now send the message <img src='" + ico_compl  + "' />"); 
            $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
            }else{
                $("#div_minchars_info").html("You've written <span style='color:red'>" + str_len + "</span> word(s). You need " + (MinNumberOfWords - str_len) + " word(s) to send this message <img src='" + ico_incompl  + "' />");
                $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");
            }
          });
      }
    })});

Thank you very much.
Winging
Winging
Forumember

Female Posts : 147
Reputation : 4
Language : traditional chinese

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

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki July 18th 2021, 8:20 am

hello

try this instead JS(In the topics)

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');
 }
});
});
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging July 18th 2021, 8:26 am

hello,@skouliki

This new code has no effect.
And even the part of [counting total words] disappeared. About the number of words to reply 1f602
Winging
Winging
Forumember

Female Posts : 147
Reputation : 4
Language : traditional chinese

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

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki July 18th 2021, 4:05 pm

i tested the code and it is working

About the number of words to reply Scree697

see if your other javascript is causing you conflicts
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging July 19th 2021, 4:06 am

Thanks,@skouliki

I found that it was changed to(In all the pages),and a warning will appear from above
After I tested it, there were more than the number of words (I set 10 words), but I could not successfully post a reply.

About the number of words to reply O11


And the part of [Count the total number of words],how can I add it to the code?

Original code diagram:
About the number of words to reply Yz10

PS:I'm not sure, how to see if there is a conflicting part in JS
Winging
Winging
Forumember

Female Posts : 147
Reputation : 4
Language : traditional chinese

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

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki July 19th 2021, 3:23 pm

yes you are right it is an old code

so lets go to the first code everything it is working unless you write Chinese ?
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging July 20th 2021, 5:30 pm

yes,@skouliki

I found that when using Chinese Pinyin (not Taiwanese Pinyin), there is no way to successfully limit the [minimum number of characters] and publish directly.
This is not what i hope.

And I am not sure how to fix my JS.

Thanks your help!
Winging
Winging
Forumember

Female Posts : 147
Reputation : 4
Language : traditional chinese

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

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging July 23rd 2021, 6:28 am

skouliki wrote:yes you are right it is an old code

so lets go to the first code everything it is working unless you write Chinese ?
Thanks @skouliki

I found that the part I need to change is,
In the mobile device, the [I want limit] will not be reached, but the computer version can successfully limit
So it is the mobile device code issue?
Winging
Winging
Forumember

Female Posts : 147
Reputation : 4
Language : traditional chinese

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

Back to top Go down

In progress Re: About the number of words to reply

Post by SLGray July 23rd 2021, 8:10 am

That code was created before the mobile version was released.


About the number of words to reply Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51464
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki July 23rd 2021, 9:00 am

iam thinking that the issue is not the version but the language
i can not help any further iam sorry
maybe you can contact the creator of that code
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by cauquan1001 August 2nd 2021, 3:46 am

It worked
avatar
cauquan1001
New Member

Posts : 3
Reputation : 0
Language : Vietnamese

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki August 2nd 2021, 6:19 am

cauquan1001 wrote:It worked

Please don't hijack another member’s topic's.
Please open your own thread if you having a problem with your forum.
Please read our forum rules:ESF General Rules
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by cauquan1001 August 2nd 2021, 8:57 am

skouliki wrote:
cauquan1001 wrote:It worked

Please don't hijack another member’s topic's.
Please open your own thread if you having a problem with your forum.
Please read our forum rules:ESF General Rules
Sorry, please check my Private message!
avatar
cauquan1001
New Member

Posts : 3
Reputation : 0
Language : Vietnamese

Back to top Go down

In progress Re: About the number of words to reply

Post by cauquan1001 August 2nd 2021, 8:57 am

skouliki wrote:
cauquan1001 wrote:It worked

Please don't hijack another member’s topic's.
Please open your own thread if you having a problem with your forum.
Please read our forum rules:ESF General Rules
Sorry, please check my Private message!
avatar
cauquan1001
New Member

Posts : 3
Reputation : 0
Language : Vietnamese

Back to top Go down

In progress Re: About the number of words to reply

Post by SarkZKalie August 3rd 2021, 8:36 pm

@cauquan1001 have you tried to open a new thread post yet ?


About the number of words to reply Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1407
Reputation : 218
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Back to top

- Similar topics

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