Page 1 of 1
Direct name & email link
Posted: Fri Apr 20, 2012 6:44 pm
by steve
does anybody know a way to have a field in the submit a ticket form automatically populated based on a url?
Something like the direct company links.
Example
pointing to url
http://mydomain.com/hesk/index1.php?a=a ... John+Smith[/b]&
email=jsmith@hisdomain.com
This would automatically populate the name and email fields:
Name : John Smith
Email:
jsmith@hisdomain.com
Re: Direct name & email link
Posted: Fri Apr 20, 2012 8:01 pm
by steve
Figured it out with the power of Google.
For those who are wondering,
open hesk/index.php
paste the following near the botton of the script.
Code: Select all
<!-- Copyright 2006 Bontrager Connection, LLC
function FillForm() {
// Specify form's name between the quotes on next line.
var FormName = "form1";
var questionlocation = location.href.indexOf('?');
if(questionlocation < 0) { return; }
var q = location.href.substr(questionlocation + 1);
var list = q.split('&');
for(var i = 0; i < list.length; i++) {
var kv = list[i].split('=');
if(! eval('document.'+FormName+'.'+kv[0])) { continue; }
kv[1] = unescape(kv[1]);
if(kv[1].indexOf('"') > -1) {
var re = /"/g;
kv[1] = kv[1].replace(re,'\\"');
}
eval('document.'+FormName+'.'+kv[0]+'.value="'+kv[1]+'"');
}
}
FillForm();
//-->
</script>
Now just add the &fieldname=value to the end of your URL
Example
http://mydomain.com/hesk/index1.php?a=add&name=John_ mith&email=
jsmith@hisdomain.com