Making Message Field Have Maximum Characters Allowed

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
ISO Retail
Posts: 28
Joined: Thu Sep 25, 2008 3:19 am

Making Message Field Have Maximum Characters Allowed

Post 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.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.';
}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ISO Retail
Posts: 28
Joined: Thu Sep 25, 2008 3:19 am

Post by ISO Retail »

Thank you very much!
ISO Retail
Posts: 28
Joined: Thu Sep 25, 2008 3:19 am

Post by ISO Retail »

I tried the code and when i press the submit button i get a white screen.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Enable debug mode in settings then submit it again and see if you get an error message.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ISO Retail
Posts: 28
Joined: Thu Sep 25, 2008 3:19 am

Post 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
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ISO Retail
Posts: 28
Joined: Thu Sep 25, 2008 3:19 am

Post by ISO Retail »

What can I say YOU ARE PHP MASTER!

Works fine now thank you sir!
Post Reply