Forums

ASP

This topic is locked

Limiting textbox words BUT......

Posted 14 Dec 2002 19:35:04
1
has voted
14 Dec 2002 19:35:04 LiToZ LiToZ posted:
Well, i have made a text box characters limiter, and everything have been working on just fine... BUT now i am facing an issue that the normal limiter doesnt work on....
i have a text box that the user can write &lt;blink&gt; inside it to send blinking SMS ... and i STILL need all of the characters he type to be limited EXCEPT the &lt;blink&gt; when h writes it.. so can anyone tell me in code how i can make the text limiter DOESNT count the word <b>&lt;BLINK&gt;</b> ??? PLEASE help is needed with that urgent <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

Edited by - AkMaLiTo-C on 14 Dec 2002 19:38:12

Replies

Replied 16 Dec 2002 18:52:05
16 Dec 2002 18:52:05 Dave Blohm replied:
just do a

Replace(myField,"&lt;blink&gt;",""

hope this helps...

Doc
Rangewalk Digital Studios
Replied 16 Dec 2002 19:30:30
16 Dec 2002 19:30:30 LiToZ LiToZ replied:
First Of all thanks for your reply <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
well, i didnt know exactly how to use this code, and actually i guess it REMOVES &lt;Blink&gt; when the user writes it, but i want it to STAY in the text field but dont be counted in the counter/limiter, and the <b>MOST IMPORTANT THING</b>, that the other characters BE counted and limited to 160 characters... ex: if the user types:
test &lt;blink&gt;again&lt;blink&gt; test
the counter should count and apply the limiter ONLY to <b>test again test</b> ... sorry i guess that seems quizzy but really without that code i am facing a big problem ! :S

here is the page code:
&lt;textarea style="font-size: 8pt; font-family: Geneva, Arial, Helvetica, san-serif; color: #FF0000; font-weight: bold; BORDER-RIGHT: #FFCCCC 3px groove; BORDER-TOP: #FFCCCC 3px groove; BORDER-LEFT: #FFCCCC 3px groove; WIDTH: 300px; BORDER-BOTTOM: #FFCCCC 3px groove; HEIGHT: 88px; BACKGROUND-COLOR: #00CCFF" name="DataSent" cols="30" rows="5" onKeyDown="textCounter(document.SendTextSms.DataSent,document.SendTextSms.remLen1,160)" onKeyUp="textCounter(document.SendTextSms.DataSent,document.SendTextSms.remLen1,160)"&gt;&lt;/textarea&gt;
&lt;input readonly type="text" name="remLen1" size="3" maxlength="3" value="160"&gt;
&lt;font color="#CCFFFF" size="2"&gt;characters left.&lt;/font&gt;&lt;br&gt;

&lt;SCRIPT LANGUAGE="JavaScript"&gt;
&lt;!-- Begin
function textCounter(field,cntfield,maxlimit) {
if (field.value.length &gt; maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
// End --&gt;
&lt;/script&gt;


Hope u can help me out with that

Edited by - AkMaLiTo-C on 16 Dec 2002 19:31:59

Edited by - AkMaLiTo-C on 17 Dec 2002 08:36:25
Replied 22 Dec 2002 15:22:25
22 Dec 2002 15:22:25 LiToZ LiToZ replied:
hey, nobody can help me out with that please ? ? ? ?

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 05 Jan 2003 07:12:18
05 Jan 2003 07:12:18 Dave Blohm replied:
You still need help on this one? I've been on break for two weeks and vowed not to touch my computer while on vacation (except to find a good deal on some new skis!!!).

Doc
Rangewalk Digital Studios
Replied 05 Jan 2003 11:22:28
05 Jan 2003 11:22:28 LiToZ LiToZ replied:
Actually yes i still need that help <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle> and please if you dont understand my problem exactly tell me an di will post here EXACT details even more than the one on my previous reply.. ! thanks <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 26 Jan 2003 02:17:20
26 Jan 2003 02:17:20 LiToZ LiToZ replied:
well i guess that this topic is totally forgotten.. but you wont beleive that.. i STILL need that code and i still didnt enable that service on my site due to missing that code.. please anyone try to help me out in that.. thanks

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 26 Jan 2003 12:36:12
26 Jan 2003 12:36:12 Jørgen Emerslund replied:
&lt;%
function CharCount()
dim strInput ' To hold the string we're working on

strInput = Request.Form("DataSent"
strInput = Replace(strInput, "&lt;blink&gt;", "", 1, -1, 1)
strInput = Replace(strInput, "&lt;/blink&gt;", "", 1, -1, 1)
CharCount = strInput
end function
%&gt;

That should get you on your way. Come back if you want even more details...

Edited by - Stanly on 26 Jan 2003 12:37:00
Replied 26 Jan 2003 17:16:58
26 Jan 2003 17:16:58 LiToZ LiToZ replied:
well, thx for your help regarding my issue <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> but there is somthing i dont understand well here <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
look, i need the script to be counting the text box entry in the same time as the user is typing, here is the sequence i have right now:
first: the code in the text box that CALLS the functionin real time
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> onKeyDown="textCounter(document.SendTextSms.DataSent,document.SendTextSms.remLen1,160)" onKeyUp="textCounter(document.SendTextSms.DataSent,document.SendTextSms.remLen1,160)"&gt;<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Second the function that is called by that code to DO the counting:
SCRIPT LANGUAGE="JavaScript"&gt;
function textCounter(field,cntfield,maxlimit) {
if (field.value.length &gt; maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
/script&gt;

So what i need now is to include your code in that function to do both counting rules in the same time, the first which is already made which counts any text input normally and decrease the maxlimit by one for every character written.. and the second should b from the code you supplied that when the user writes <b>&lt;blink&gt;</b> , the function should increase the maxlimit of the text box by 7 which is the count of characters in &lt;blink&gt; .. hope i was able to explain it well <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

I placed and example to see it working on www.EgMob.com/forDMXzone.asp , this is the function working normally but ofcourse without the thing i need which is NOT TO COUNT &lt;blink&gt; when it is written <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle> hope that helps more to get the whole issue <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> thanks in advance

Edited by - AkMaLiTo-C on 26 Jan 2003 17:34:25
Replied 27 Jan 2003 21:28:58
27 Jan 2003 21:28:58 Brent Colflesh replied:
Dear AkMaLiTo-C,
Maybe I don't fully understand what you want, but it seems to that you should have 2 checkboxes (dropdowns, whatever) and a text field.

checkbox 1 - Normal SMS
checkbox 2 - Blinking SMS

Textfield (limited to x amount of characters)- if checkbox 2 is selected concatenate the blink tags to the beginning and end of the string before submitting it.

Regards,
Brent

Replied 28 Jan 2003 04:05:04
28 Jan 2003 04:05:04 LiToZ LiToZ replied:
well, actually if that was the solution it would be GREAT... but the problem is that there is a special way to deal with th e&lt;blink&gt; tag so that it can be enetered in the text field MORE than once to make SOME text blink and others dont.. well, in the link i posted in my previous post Click on the HELP button on the page to understand exactly what i mean <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 28 Jan 2003 17:59:34
28 Jan 2003 17:59:34 Brent Colflesh replied:
Dear AkMaLiTo-C,
So have a limited textbox - submit it - create an array of all the words in the message - display them as a dropdown or checkboxes - have the user select which words will blink - submit again and concatenate blink tags around those words.

No problem.

Regards,
Brent

Replied 28 Jan 2003 18:59:59
28 Jan 2003 18:59:59 LiToZ LiToZ replied:
well that is a nice idea but i guess it should be easier for both me and the user that he purt in the text box the &lt;blink&gt; tags he want around the word/s he want it to be blinking... and my issue is easy i guess but the problem is that i dont know exactly how to code it, i just need a line of code that when the user WRITES &lt;blink&gt; in the text box, the text box limiter is increased by 7 so that the word blink will be as if it is NOT counted and the actual character limit will be only assigned to ANY otherword except &lt;blink&gt; ... so cant you help me with that line of code that when it reads &lt;blink&gt; as the user types it it will ADD 7 to the limit of the text box ? <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 28 Jan 2003 21:23:27
28 Jan 2003 21:23:27 Brent Colflesh replied:
Dear AkMaLiTo-C,
I'm trying to give you the logical option, since you are trying to dynamically change a static HTML property on the client side - can't do it.

If for some reason it has to occur the way you describe, you need to use a textfield in JAVA, Flash, or Shockwave - then have them adjust the limit dynamically.

Regards,
Brent

Replied 29 Jan 2003 03:47:46
29 Jan 2003 03:47:46 LiToZ LiToZ replied:
well i guess that can be done with a normal text field using a java script i guess.. because since the java script CAN change the remaining charachters to be written in the text field AS the user is typing, then why doesnt it change that limit each time the user writes &lt;blink&gt; ? <img src=../images/dmxzone/forum/icon_smile_dead.gif border=0 align=middle>

Edited by - AkMaLiTo-C on 29 Jan 2003 03:52:47
Replied 29 Jan 2003 18:24:51
29 Jan 2003 18:24:51 Brent Colflesh replied:
Dear AkMaLiTo-C,
You could adapt one of these:

javascript.internet.com/forms/limit-textarea.html

www.shiningstar.net/articles/articles/javascript/dynamictextareacounter.asp?ID=AW

- check for a complete blink tag and not decrease the counter...

But - they are Javascripts, easily defeated by turning off Javascript in any major browser - so they are not a professional solution.

Regards,
Brent

Replied 29 Jan 2003 18:36:42
29 Jan 2003 18:36:42 LiToZ LiToZ replied:
Dear bcolflesh,
actually the link you provided IS the java-script i used so far... but the golden question i have is HOW TO ADAPT it to not to count the &lt;blink&gt; tag when it is written.. that is my main issue that i need help with, i DO have a workingtext area limit to 160 charachters, but i dont know how to make that java script pass by counting a &lt;blink&gt; tag when it is written.. hope you can code that small part and pass it to me <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> thanks you for your interest in that issue bcolflesh <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> waiting for your help with that <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

==| Running PWS4 - Ultradev4 - Asp VBscript - access 2000 DB |==
Replied 29 Jan 2003 22:32:52
29 Jan 2003 22:32:52 Brent Colflesh replied:
Dear AkMaLiTo-C,
I'm afraid you'll have to do what I would do if I had any inclination to use Javascript - seach Google and get out a language reference and read!

Regards,
Brent

Reply to this topic