Page 1 of 1

Making Message Field Have Maximum Characters Allowed

Posted: Mon Nov 10, 2008 3:56 am
by ISO Retail
Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:


Hey guys, thanks for all the help so far.

We was wondering if anyone could tell us how to make the maximum characters allowed in the message field & subject on the support ticket. We dont know which file to look at.

We dont want people cutting and pasting emails into the ticket or rambling on. So if there's a way to say have a 300 character max and only have the subject field only to have 5 numeric characters. The subject field would only allow a person to enter numeric values only.

If anyone could tell us how to do it and to which file it would be appriciated.

Thanks again for everything.

Posted: Sat Nov 15, 2008 9:16 am
by Klemen
It's in "submit_ticket.php". Open it in a plain text ediotr (Wordpad, Notepad, ...) and change

Code: Select all

$subject=hesk_input($_POST['subject']) or $hesk_error_buffer[]=$hesklang['enter_ticket_subject'];
to

Code: Select all

$subject=hesk_isNumber($_POST['subject']) or $hesk_error_buffer[]='Enter digits 0-9 only for the subject';
and BELOW

Code: Select all

$message=hesk_input($_POST['message']) or $hesk_error_buffer[]=$hesklang['enter_message'];
paste this code (modify numbers to fit your requirements):

Code: Select all

if (strlen($subject) > 5 || preg_match())
{
	$hesk_error_buffer[]='Your subject is too long, limit it to 5 chars.';
}
if (strlen($message) > 300)
{
	$hesk_error_buffer[]='Your message is too long, limit it to 300 chars.';
}

Posted: Tue Nov 18, 2008 7:42 am
by ISO Retail
Thank you very much!

Posted: Sat Jan 17, 2009 7:32 am
by ISO Retail
I tried the code and when i press the submit button i get a white screen.

Posted: Sat Jan 17, 2009 8:57 am
by Klemen
Enable debug mode in settings then submit it again and see if you get an error message.

Posted: Thu Apr 30, 2009 1:45 am
by ISO Retail
Parse error: syntax error, unexpected $end in /home/a1419099/public_html/support/submit_ticket.php on line 285

I get this error when i run the script in version 2.0

Posted: Thu Apr 30, 2009 8:11 am
by Klemen
This is probably because you have an extra { somewhere that is not properly closed with an }

If you can't find it I'd recommend doing it from scratch.

Posted: Fri May 01, 2009 7:06 am
by ISO Retail
What can I say YOU ARE PHP MASTER!

Works fine now thank you sir!