How to make default Subject and Message fields not required?

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
MOB
Posts: 54
Joined: Sat May 10, 2008 9:51 am

How to make default Subject and Message fields not required?

Post by MOB »

Script URL: (private)
Version of script: 2.5.2
Hosting company: canaca.com
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Here in this forum, found no hits if it has been mentioned before.

Write your message below:

I'd like to learn if this could be possible?

I have set up Hesk Desk to be a different type support page where in the initial submission there are other required fields they must fill out, where the default Subject and Message fields are not required.

So is there a way to disable that those two default fields are not marked as Required Fields when creating the ticket? But still be required when they reply to their tickets?

As a workaround,
I modified the code in index.php, but I wish this could be switched on/off in the Settings. Or if you could suggest a better workaround?

My version, though it works for me, is quite a dirty way to go about it. :) (see image below to see what it looks like):

**I'd like it for also be able to change the language of the message--in case it's a multilingual site.

Image

OPEN: index.php

FIND:

Code: Select all

	<!-- END CUSTOM BEFORE -->

	<!-- ticket info -->
	<table border="0" width="100%">
	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['subject']; ?>: <font class="important">*</font></td>
	<td width="80%"><input type="text" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['c_subject'])) {echo stripslashes(hesk_input($_SESSION['c_subject']));} ?>" <?php if (in_array('subject',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> /></td>
	</tr>
	<tr>
	<td style="text-align:right" width="150" valign="top"><?php echo $hesklang['message']; ?>: <font class="important">*</font></td>
	<td width="80%"><textarea name="message" rows="12" cols="60" <?php if (in_array('message',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> ><?php if (isset($_SESSION['c_message'])) {echo stripslashes(hesk_input($_SESSION['c_message']));} ?></textarea>
REPLACE WITH:

Code: Select all

	<!-- END CUSTOM BEFORE -->

	<!-- ticket info -->
	<table border="0" width="100%">
	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['subject']; ?>: <font class="important">*</font></td>
	<td width="80%"><input type="text" name="subject" size="40" maxlength="40" value="Subscription/Suscripción<?php if (isset($_SESSION['c_subject'])) {echo stripslashes(hesk_input($_SESSION['c_subject']));} ?>" <?php if (in_array('subject',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> /></td>
	</tr>
	<tr>
	<td style="text-align:right" width="150" valign="top"><?php echo $hesklang['message']; ?>: <font class="important">*</font></td>
	<td width="80%"><textarea name="message" rows="12" cols="60" <?php if (in_array('message',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> >How did you find us? / ¿Cómo se enteró de nosotros?<?php if (isset($_SESSION['c_message'])) {echo stripslashes(hesk_input($_SESSION['c_message']));} ?></textarea>
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to make default Subject and Message fields not requi

Post by Klemen »

HESK currently requires both a subject and a message, but you could make it not required by modifying submit_ticket.php

Change

Code: Select all

$tmpvar['subject']  = hesk_input( hesk_POST('subject') ) or $hesk_error_buffer['subject']=$hesklang['enter_ticket_subject'];
$tmpvar['message']  = hesk_input( hesk_POST('message') ) or $hesk_error_buffer['message']=$hesklang['enter_message'];
to something like

Code: Select all

$tmpvar['subject'] = hesk_input( hesk_POST('subject', 'Your default subject') );
$tmpvar['message']  = hesk_input( hesk_POST('message', 'Your default message') );
You will need to do similarly in the "admin/admin_submit_ticket.php" and also you will want to remove the * (red asterisk denoting a required field) from the index.php file next to the subject and message fields.
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
MOB
Posts: 54
Joined: Sat May 10, 2008 9:51 am

Re: How to make default Subject and Message fields not requi

Post by MOB »

Thanks for the support. :)
Post Reply