Form errors Will remove any attachments

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Lurking
Posts: 32
Joined: Sun Nov 28, 2010 4:57 am

Form errors Will remove any attachments

Post by Lurking »

Script URL: http://www.slotdoctor.com/submit_ticket.php
Version of script: 2.5.3
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:

Hi,
I noticed when customer submits a form, but forgets a selection (any "required" validation), the form generates an error (as designed), but any attachments that were attached to ticket are removed without the customers knowledge. They would then click submit again after correcting the missing selection, unknowingly submitting a ticket without the attachments (unless they happen to look at the attachments again before sending).

Also when using "check boxes" on form, they are also unchecked when an error is generated, forcing the customer to check them again before submitting form.
EXAMPLE: I have 2 check boxes that are "required selections" located just after the message box (Please See my URL provided). These "check boxes" will deselect automatically when another unrelated "required" option generates a validation error.
I tried to use radio buttons, but when only ONE radio button is used, it is pre-selected. This won't work for my needs.
I currently modified the code from my other post here: viewtopic.php?f=13&t=4280&hilit=radio+button+selected as I do not want radio buttons to be automatically checked. This works fine but only if there are more than one radio button option to choose from. Seems when one radio button used, it is selected.
Thanks for any help or suggestions you might be able to provide. Larry

PS- I use "spry Tabs" and iframe on website, but have the same problem the normal route. I provided links to both pages for you to see.
Last edited by Lurking on Fri Jul 11, 2014 2:29 am, edited 2 times in total.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Form errors Will remove any attachments

Post by Klemen »

Unfortunately the attachments are indeed gone, it is not possible to reset them on the form after submitting it. To make this work attachments would have to be processed in the parallel (for example uploaded to a temporary folder and moved to the attachments after the from is successfully submitted). I am aware of the inconvenience and this is planned for a future update.

The way checkboxes currently work is that you need to enter at least 2 values under "Options". This is indeed another thing that needs to be fixed in the future. A temporary work-around might be to use a radio box instead with two values (Yes and No) and then verify that the correct selection has been made in the submit_ticket.php file above

Code: Select all

if (count($hesk_error_buffer))
something like

Code: Select all

if (hesk_POST('custom19') != 'Yes')
{
	$hesk_error_buffer['custom19'] = 'Please mark that you have read the terms and conditions of this website';
}
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
Lurking
Posts: 32
Joined: Sun Nov 28, 2010 4:57 am

Re: Form errors Will remove any attachments

Post by Lurking »

Thanks for your reply!
Should I replace this line: "if (count($hesk_error_buffer))" with the code provided, or enter it below this line? Will this code verify "yes" must be selected if I use 2 radio buttons? Thank you, Larry
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Form errors Will remove any attachments

Post by mkoch227 »

Place the custom code above

Code: Select all

if (count($hesk_error_buffer))
The code sample Klemen provided should work without any issues if your custom field is #19.
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
Lurking
Posts: 32
Joined: Sun Nov 28, 2010 4:57 am

Re: Form errors Will remove any attachments

Post by Lurking »

Thanks Mike,
I was inserting below that line (oops) and was able to do the same for other radio button by changing field number to "20". Thank you for your help with this. Larry
Post Reply