Page 1 of 1

Custom fields not cleared when form reloads

Posted: Wed Aug 01, 2018 3:28 pm
by sp119
Script URL: s1.grad.gatech.edu/hesk/
Version of script: 2.8.2
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Clear custom fields
Write your message below:

We are starting to get walk-in traffic and want to have these folks fill out a help ticket in a specific category (walk-in). We plan to have a computer setup in Kiosk mode to load just this form: http://s1.grad.gatech.edu/hesk/index.ph ... category=4 (this is on our test environment, not production).

Once the person completes and submits we want to have them click on "Home" and it will go back to this form. All of this works, however, when the form reloads the custom fields are not cleared out. Their name, email and other regular form items are all cleared out but any custom fields keep the data from when the form was last submitted.

Is there some way to force these fields to also be cleared out? We already use Hesk as our helpdesk and would like to just expand on it with our walk-in folks. However we can't have any of the fields show previous person's data so I need to figure out a way to flush these fields when the form reloads.

Any ideas greatly appreciated. I've tried setting browser settings to not save any form data and I've even run the form in privacy mode but the custom fields won't clear unless you close and re-open the browser. Need them to clear without closing and re-opening the browser.

Re: Custom fields not cleared when form reloads

Posted: Wed Aug 01, 2018 3:41 pm
by mkoch227
It looks like the custom fields are not properly cleared from the session, which is why they persist when loading the create ticket page. I haven't tested this fix, but you can try making the following change to submit_ticket.php and see if it works properly without errors (make a backup of your current submit_ticket.php file you can revert to in case this doesn't fix the issue :wink: ):

Find:

Code: Select all

hesk_cleanSessionVars('img_verified');
Just after that line, add the following:

Code: Select all

foreach ($hesk_settings['custom_fields'] as $k => $v)
{
    hesk_cleanSessionVars("c_$k");
}

Re: Custom fields not cleared when form reloads

Posted: Wed Aug 01, 2018 3:54 pm
by sp119
Mike,

Yep, that works! Thanks I appreciate the quick response!!

Re: Custom fields not cleared when form reloads

Posted: Wed Aug 01, 2018 5:57 pm
by Klemen
It's not a bug, it's a feature :)

This was actually by design. It may be better to add a setting in the future to allow Hesk admin to control this behavior.

Thanks Mike for providing a quick work-around.