The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Problem in Add a word counter to the editor

View previous topic View next topic Go down

Solved Problem in Add a word counter to the editor

Post by Michael_vx on March 22nd 2014, 6:20 am

the code in that page
http://help.forumotion.com/t131191-add-a-word-counter-to-the-editor#879368
is only working for English letters and dose not recognize the arabic letters can any one fix this for me
otherways the code wont work at my forum thanks


Last edited by Michael_vx on March 22nd 2014, 7:54 pm; edited 1 time in total (Reason for editing : Problem solved)

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by SLGray on March 22nd 2014, 6:31 am

Someone would need to translate the code into Arabic so it would recognize the Arabic letters.


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


SLGray
Administrator
Administrator

Male Posts : 36735
Reputation : 2446
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur on March 22nd 2014, 6:35 am

I'll have a look when I have free time. The problem may be with the regular expression.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx on March 22nd 2014, 6:45 am

@Ange Tuteur wrote:I'll have a look when I have free time. The problem may be with the regular expression.
thats good news to i will be waiting for the fixed code that able to count Arabic letters

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx on March 22nd 2014, 5:56 pm

is there any good news about the code ?

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur on March 22nd 2014, 7:37 pm

I've converted it to a character counter, it is a bit difficult to count the Arabic words since they are not recognized as a word character.

Try this :
Code:
$(function(){$(function(){

  var MinNumberOfChars = 50;
  var ico_compl = "http://i73.servimg.com/u/f73/18/10/89/49/ok-gre10.png";
  var ico_incompl = "http://i73.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'> Minimum characters to send a message: " + MinNumberOfChars + " </div><div id='div_minchars_info'></div></div>");
 
  var sceditor = $("#text_editor_textarea").sceditor("instance");
  var str = sceditor.val();
  var str_len = str.length;
 
  if(str_len >= MinNumberOfChars) $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
 
  sceditor.keyUp(function(e) {
  str = sceditor.val();
  str_len = str.length;
  if(str_len >= MinNumberOfChars) {
  $("#div_minchars_info").html("You've written <span style='color:green'>" + str_len + "</span> character(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> character(s). You need " + (MinNumberOfChars - str_len) + " character(s) to send this message <img src='" + ico_incompl + "' />");
  $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");
  }
  });
  }
  })});

To change the minimum number of characters modify the value of MinNumberOfChars.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx on March 22nd 2014, 7:53 pm

thanks so much its worked
Problem solved
thanks so much again

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur on March 22nd 2014, 8:11 pm

You're welcome :rose:

Topic solved and archived

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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