Page 1 of 1

[RESOLVED] How to ignore first Category

Posted: Mon Jun 22, 2009 9:44 pm
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

Posted: Tue Jun 23, 2009 6:35 am
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.

Posted: Tue Jun 23, 2009 7:27 am
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

Posted: Tue Jun 23, 2009 3:44 pm
by Klemen
That's exactly how it should work, just don't forget the

Code: Select all

value=""
part in the <option>!

Posted: Tue Jun 23, 2009 6:04 pm
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)

Posted: Mon Aug 31, 2009 2:14 pm
by llachance
Klemen,
How is an option like this implemented for required custom pulldown fields?

Posted: Mon Aug 31, 2009 4:49 pm
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.

Posted: Mon Aug 31, 2009 5:57 pm
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.

Posted: Mon Aug 31, 2009 6:31 pm
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

Posted: Thu Sep 24, 2009 3:42 pm
by Raven
I for one would love to take a peak at some of the mods you (and others) have made :)

Posted: Sun Oct 25, 2009 3:22 pm
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.