[RESOLVED] v2.3 Error checking on form Dropdown & Checkboxes
Moderator: mkoch227
[RESOLVED] v2.3 Error checking on form Dropdown & Checkboxes
Hi, I've noticed that error checking is not being performed on form Options, Check boxes and Dropdown lists...
Submit a blank ticket to cause the errors to see what I mean: http://www.crikey-thatsmint.com/hesk23/index.php?a=add
Cheers
Submit a blank ticket to cause the errors to see what I mean: http://www.crikey-thatsmint.com/hesk23/index.php?a=add
Cheers
Last edited by Raven on Tue Sep 20, 2011 7:37 pm, edited 1 time in total.
Re: 2.3 - Error checking on form Options, Check boxes & Drop
They are checked, just not marked in red. Radio buttons and select boxes have a value selected that's why you don't get an error, but checkbox errors are reproted in your form ("Missing required field: Custom field 5").
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: 2.3 - Error checking on form Options, Check boxes & Drop
Ahh makes sense... So, how can I have the drop down list show '--Please Select--' as a default value but it be a null value until someone selects something else?
I've tried to mirror the alterations made from 2.2 without success so far..
The check boxes highlight in red when I browse using my phone 'mobile safari' but don't get highlighted in firefox - not tested on any other browser.
Also, is there anyway to not have a default value for radio buttons (same as check boxes)?
I've tried to mirror the alterations made from 2.2 without success so far..
The check boxes highlight in red when I browse using my phone 'mobile safari' but don't get highlighted in firefox - not tested on any other browser.
Also, is there anyway to not have a default value for radio buttons (same as check boxes)?
Re: 2.3 - Error checking on form Options, Check boxes & Drop
I guess checkbox highlight depends on browser, some may not support that.
For select boxes you could add just after in index.php (twice!).
Checkboxes are a bit more tricky because browsers select a default value if none is set. You would have to create an empty one in the same index.php before any other checkboxes, like
For select boxes you could add
Code: Select all
<option value="">-- Please select --</option>
Code: Select all
<select name="'.$k.'" '.$cls.'>
Checkboxes are a bit more tricky because browsers select a default value if none is set. You would have to create an empty one in the same index.php before any other checkboxes, like
Code: Select all
<label><input type="checkbox" name="'.$k.'[]" value="" />Please select one of options below:</label><br />
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: 2.3 - Error checking on form Options, Check boxes & Drop
Hi and thanks for the reply but that's exactly what I have for the drop-downs and although I've set three 'test options' (option 1, option 2 and option 3) it's initial state is 'option 1' as opposed to '--Please Select--'..?
I've also tried adding and without success.
Any ideas?
I've also tried adding
Code: Select all
<select name="'.$k.'" '.$cls.' id="custom"><option SELECTED value="">- Please Select -</option>
Code: Select all
<select name="'.$k.'" '.$cls.' id="custom"><option SELECTED="SELECTED" value="">- Please Select -</option>
Any ideas?
Last edited by Raven on Tue Sep 20, 2011 7:15 pm, edited 1 time in total.
Re: 2.3 - Error checking on form Options, Check boxes & Drop
Like my previous post says, you need to edit that code in file index.php 

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


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
Re: 2.3 - Error checking on form Options, Check boxes & Drop
I did/am... 
**EDIT**
As you can see, the '- Please Select -' option is there and at the top of the list for both drop-downs but it's not initially selected: http://www.crikey-thatsmint.com/hesk23/index.php?a=add
Double checking the code for my version 2.2 installation of HESK it is ecactly the same except for the '.$cls.' part and works without any problems... Could this be the problem I wonder?
**EDIT 2**
Scrap that, just tried removing it and it still doesn't work... hmmm

**EDIT**
As you can see, the '- Please Select -' option is there and at the top of the list for both drop-downs but it's not initially selected: http://www.crikey-thatsmint.com/hesk23/index.php?a=add
Double checking the code for my version 2.2 installation of HESK it is ecactly the same except for the '.$cls.' part and works without any problems... Could this be the problem I wonder?
**EDIT 2**
Scrap that, just tried removing it and it still doesn't work... hmmm
Last edited by Raven on Tue Sep 20, 2011 7:30 pm, edited 1 time in total.
Re: 2.3 - Error checking on form Options, Check boxes & Drop
Hmm, try removing this as well (should be 4 times; I'm not testing tips I give here):
$cls is responsible for printing class="isError" (red borders) if a filed has been marked as required but missing.
Code: Select all
strlen($k_value) == 0 ||
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: 2.3 - Error checking on form Options, Check boxes & Drop
Lol - I just removed and replaced it with and it works fine now... Wonder why it is stripping out the initial '- Please Select -' option...?
Code: Select all
if (strlen($k_value) == 0 || $k_value == $option)
Code: Select all
if ($k_value == $option)
Re: 2.3 - Error checking on form Options, Check boxes & Drop
...and do I really need to remove from the 'radio' buttons..?
PS
Added [RESOLVED] to the subject of this thread to help others as the initial question has been answered
Code: Select all
strlen($k_value) == 0 ||
PS
Added [RESOLVED] to the subject of this thread to help others as the initial question has been answered
