[RESOLVED] How to ignore first Category

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

[RESOLVED] How to ignore first Category

Post by Raven »

Hi all, does anyone know how I can make it so that the 1st category does not count/gets checked when submitting a new Ticket..? What I mean is if someone tries to submit a new ticket but does not select a category other than the initial default 1st one in the list then it will fail validation same as it does if you miss out your name, email, security number/spam question etc...

This is what I have thus far within the 'Manage categories' section of the Admin section to help give you an idea of what it is I need:

Code: Select all

- Please Select -
Technical Support
Schedule On-site Visit
General Enquiries
Customer Services
Products & Services
Advertising & Sponsorship
Website Feedback
If the user leaves the '- Please Select -' item selected then the submission will fail -

Thanks
Last edited by Raven on Sat Oct 17, 2009 7:03 pm, edited 3 times in total.
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You can add something like

Code: Select all

<option value="">- Select -</option>
just below

Code: Select all

<select name="category">
in index.php file.
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
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Thanks for your reply :)

That sorts out the drop-down but I meant, how to do the form checking so I get an error if it is left on the - Please Select - item same as I do with all of the other form items?

I.E.

Code: Select all

Error Detected!

    * Please enter the anti-spam number
    * Please enter your name
    * Please enter a valid e-mail address
    * Please select the appropriate category
    * Please enter a subject for your Ticket
    * Please enter your message
If you see what I mean...

Thanks
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

That's exactly how it should work, just don't forget the

Code: Select all

value=""
part in the <option>!
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
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Ahh cool - thank you for all of your help :)

I knew how to do the first bit but thought that I would need to add the 'on error' part manually - how cool is it that this function was already there!

Again thank you sooo much for your quick concise help 8)
llachance
Posts: 3
Joined: Mon Aug 31, 2009 2:01 pm

Post by llachance »

Klemen,
How is an option like this implemented for required custom pulldown fields?
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

In index.php file you could change

Code: Select all

<select name="'.$k.'">
to

Code: Select all

<select name="'.$k.'">
<option value=""> - Select - </option>
It needs to be changed twice in the index.php file. And make sure you don't delete the '; at the end of the line.
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
llachance
Posts: 3
Joined: Mon Aug 31, 2009 2:01 pm

Post by llachance »

It still displays the first item in the custom list as selected.

I think the following logic may also need to be modified as well.

Code: Select all

if (strlen($k_value) == 0 || $k_value == $option)
{
$k_value = $option;
$selected = 'selected="selected"';
}
else
{
$selected = '';
}
I'm not exactly sure what it is doing so I don't feel comfortable trying to change it myself.
llachance
Posts: 3
Joined: Mon Aug 31, 2009 2:01 pm

Post by llachance »

Klemen,

I figured out what changes needed to be made

this code needs to be modified

Code: Select all

if (strlen($k_value) == 0 || $k_value == $option)
{
$k_value = $option;
$selected = 'selected="selected"';
}
else
{
$selected = '';
}
to be

Code: Select all

if ($k_value == $option)
{
$k_value = $option;
$selected = 'selected="selected"';
}
else
{
$selected = '';
}
We here at Family Services of NW PA love your hesk.
I will have to take some time and post up some of the mods we have made that you and others may find useful
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

I for one would love to take a peak at some of the mods you (and others) have made :)
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Hi llachance (and anyone else that has made any custom modifications to HESK).

Just wondering if you could find time to post some of your mods that you have made to HESK? :) I know that I for one would be very intrested to see what other users are doing with their HESK to make it better and/or change the functions to match different situations.
Post Reply