Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
CJ Webmaster Forums Forum Index -> PHP Scripts » CJ Send Page

   
"Your Message (optional)" unlimited characters(v2)
View previous topic :: View next topic  
Author Message
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Sun Jan 08, 2006 5:42 pm    Post subject: "Your Message (optional)" unlimited characters(v2)

The optional part at the code:

"Your Message (optional)" is set to unlimited characters!

How to limit that section to a given no. of characters?

Thanks in advance,

Mike
Back to top
centre
CJ-Design.com Moderator



Joined: 13 Jun 2004
Posts: 174
Location: Canada

Posted: Sun Jan 08, 2006 5:53 pm    Post subject:

To my knowledge it is not set to unlimited. It is set to something like 48 columns of text and 8 rows.
_________________
centre
CJ Website Design Forum Moderator

Forum Rules (applied as of February 16, 2006)
Back to top
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Sun Jan 08, 2006 8:14 pm    Post subject:

yes.. which allows someone to paste a huge article in it!

My question is how to make it just for a couple of lines only (a comment, not a whole page!) Confused

thx
Back to top
darkcarnival
CJ-Design.com Admin



Joined: 10 Jul 2003
Posts: 1451
Location: Michigan

Posted: Sun Jan 08, 2006 9:47 pm    Post subject:

please dont post in big text like that

well first off its ment to send the whole page, how to limit it, I would think theres a js code that could help with this.

ill have to check that out.
_________________
Admin of CJ-Design Forum
watch out spammers, I'm watching you!

offical rules:
http://www.cj-design.com/forum/viewtopic.php?t=2002

Elite Bulletin Board v0.5 try it out today!
http://www.elite-board.z42.us/

version 0.9 coming soon!
Back to top
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Thu Jan 12, 2006 12:07 pm    Post subject:

sorry for the "big" fonts! it is an option to use! so why not use it! hehe

Anyway, I'll be waitin 4 the code..

Thanks in advance

Mike
Back to top
centre
CJ-Design.com Moderator



Joined: 13 Jun 2004
Posts: 174
Location: Canada

Posted: Sat Jan 14, 2006 12:51 am    Post subject:

Yes, Javascript is the best way to go for that. I'm not quite the Javascript expert. But, if you do a little Google search, I'm sure you'll find something.

Don't give up,

centre
_________________
centre
CJ Website Design Forum Moderator

Forum Rules (applied as of February 16, 2006)
Back to top
PHPDUMMY
CJ-Design.com Moderator



Joined: 09 Mar 2005
Posts: 573
Location: South East Kentucky,U.S.A.

Posted: Sat Jan 14, 2006 4:47 pm    Post subject:

Start -> http://us2.php.net/manual/en/function.strlen.php
_________________
Cheers,
Danny
C-J Search Engine All Tidied Up V4.0http://www.cj-design.com/forum/viewtopic.php?t=1820

C-J Search Engine MySQL !http://www.cj-design.com/forum/viewtopic.php?t=1555
Back to top
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Sun Feb 19, 2006 9:37 pm    Post subject: coding?!

I am sorry, I am not much into coding..! I can't see the right code to use from that page regarding that matter, and where to put it!

I have tried a couple of them, but it is much more than just copy and paste!

Any help would be much appreciated..

Mike
Back to top
centre
CJ-Design.com Moderator



Joined: 13 Jun 2004
Posts: 174
Location: Canada

Posted: Sun Feb 19, 2006 9:50 pm    Post subject:

I do remember seeing this code in a chat room and they had disabled the paste function. I forget the code now. This would come in handy right now.
_________________
centre
CJ Website Design Forum Moderator

Forum Rules (applied as of February 16, 2006)
Back to top
GodfatherUK
CJ-Design.com Moderator



Joined: 17 Sep 2004
Posts: 242
Location: UK

Posted: Mon Feb 20, 2006 2:42 pm    Post subject:

!! Back up files before use !!

-- OPEN config.php --

- FIND -

Code:
$your_website = "CJ Website Design";
$thankyousubject="Thank you from CJ Website Design!";


- AFTER, ADD -

Code:
$maximum = "50";   // Max Characters allowed



-- OPEN friend.php --

- FIND -

Code:
<link rel="stylesheet" href="stylesheet.php" type="text/css">


- AFTER, ADD -

Code:
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
   if (limitField.value.length > limitNum) {
      limitField.value = limitField.value.substring(0, limitNum);
   } else {
      limitCount.value = limitNum - limitField.value.length;
   }
}
</script>



- FIND -
Code:

    <tr>
      <td width="232"><? echo $yourmessage; ?></td>
      <td width="381"><textarea name="optional_message" cols="45" rows="8"></textarea></td>
    </tr>


- REPLACE WITH -

Code:

    <tr>
      <td width="232"><? echo $yourmessage; ?></td>
      <td width="381"><textarea name="optional_message" rows="8" cols="45" onKeyDown="limitText(this.form.optional_message,this.form.charsleft,<?php echo($maximum); ?>);" onKeyUp="limitText(this.form.optional_message,this.form.charsleft,<?php echo($maximum); ?>);"><?php echo($optional_message); ?></textarea>
<br>
<small>You have <input readonly class="post" type="text" size="3" name="charsleft" value="<?php echo($maximum); ?>"> characters left</small></td>
    </tr>


Hope this helps!
_________________
GodfatherUK
CJ Designs Forum Moderator

"I dont think i am good at coding.. But i KNOW im good at helping"
Back to top
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Mon Feb 20, 2006 3:10 pm    Post subject: blank comments!

Hi there

I don't have

Code:
<link rel="stylesheet" href="stylesheet.php" type="text/css">


so I put what you suggested after

Code:
/*---------------------------*/
/* end style editing #1 of 2 */
/*---------------------------*/
</style>


I got now:
"You have characters left" before the send button, but it doensn't count characters, and after sending there is no comment shown at all!

Thanks for your time
Back to top
GodfatherUK
CJ-Design.com Moderator



Joined: 17 Sep 2004
Posts: 242
Location: UK

Posted: Mon Feb 20, 2006 3:21 pm    Post subject:

Right, when it works, it should look like http://www.godfatheruk.com/charsleft.php

I will look into it and see why its not working for you
_________________
GodfatherUK
CJ Designs Forum Moderator

"I dont think i am good at coding.. But i KNOW im good at helping"
Back to top
wise_mike
Junior Member


Joined: 21 Dec 2005
Posts: 17

Posted: Wed Feb 22, 2006 12:19 am    Post subject: just limit!

Hi there

It is not important much to show how many char. left... If the script just doesn't allow any more char. in the comment pane, that great..

Thanks
Back to top
GodfatherUK
CJ-Design.com Moderator



Joined: 17 Sep 2004
Posts: 242
Location: UK

Posted: Wed Feb 22, 2006 11:56 am    Post subject:

In friend.php, FIND
Code:

   $js = $_POST['js'];
   $id = $_POST['id'];


After it add,

Code:

$maximum = "100"; // Max you will allow
$msg = strlen($optional_message); // Check length of the message


--

Find,

Code:

   if ($friend_mail == "" || $f_emailvalid == 1){
      $emsg .= "Please enter your friends valid email address<br>\n";
      $send = false;
   }


And after add,

Code:
   if ($optional_message != "" && $msg > $maximum){
      $emsg .= "Your message is greater than ".$maximum." characters<br>\n";
      $send = false;
   }


See if that will work as an alternative to what i said before. You could always place underneath the textbox tha max chars you will allow like:

Code:
<tr>
      <td width="232"><? echo $yourmessage; ?></td>
      <td width="381"><textarea name="optional_message" cols="45" rows="8"></textarea><br><small>Maximum of <b><?php echo($maximum); ?></b> characters allowed!</small></td>
    </tr>

_________________
GodfatherUK
CJ Designs Forum Moderator

"I dont think i am good at coding.. But i KNOW im good at helping"
Back to top
Display posts from previous:   
       CJ Webmaster Forums Forum Index -> PHP Scripts » CJ Send Page All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
iCGstation v1.0 Template By Ray © 2003, 2004 iOptional, Mods by CJ Website Design