Page 1 of 1

Form errors Will remove any attachments

Posted: Thu Jul 10, 2014 1:54 am
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.

Re: Form errors Will remove any attachments

Posted: Thu Jul 10, 2014 7:24 am
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';
}

Re: Form errors Will remove any attachments

Posted: Thu Jul 10, 2014 2:43 pm
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

Re: Form errors Will remove any attachments

Posted: Fri Jul 11, 2014 1:35 am
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.

Re: Form errors Will remove any attachments

Posted: Fri Jul 11, 2014 2:31 am
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