SightMax Live Chat - The Premier Installable and Hosted Live Chat Solution...

Auto Populating fields in the PreChatSurvey

rated by 0 users
This post has 9 Replies | 2 Followers

Top 25 Contributor
Posts 3
jpaglier Posted: 05-15-2006 9:29 PM | 24.91.145.236

I wanted to have better interaction with the PreChatWindow and wanted to pre-populate some of the fields when users where logged into my WebSite.  Its anoying making the users enter there name and e-mail when I should already have it, so I made the following modifications to the PreChatSurvey.

1. Remove the AutoEventWireup="false" in the first line of the file.

2. Replace all the code from <!DOCTYPE  - </HEAD> with the following

<script language="C#" runat="server">

 void OutputVar(int num)
 {
  if ( Request.QueryString["SmartMax" + num] !=  null )
   {
   Response.Write("if (typeof(theform.SmartMax" + num + ") == 'object') ");
   Response.Write("theform.SmartMax" + num + ".value = \"");
   Response.Write(Request.QueryString["SmartMax" + num]);
   Response.Write("\";");  
   
  }
 }

 void FocusVar(string var)
 {
  Response.Write("if (typeof(theform." + var + ") == 'object') ");
  Response.Write("theform." + var + ".focus();"); 
 }
 
 void Page_Load(object sender, EventArgs e){
 
  Response.Write("<HTML>");
  Response.Write("<HEAD>");
  Response.Write("<script language=javascript>");
  Response.Write(" function Populate() {");
  
  Response.Write("var theform;");
  Response.Write("if (window.navigator.appName.toLowerCase().indexOf(\"microsoft\") > -1) {");
  Response.Write("theform = document.Form1;");
  Response.Write("} else {");
  Response.Write("theform = document.forms[\"Form1\"];");
  Response.Write("}");
  
  for (int i=1; i <= 10; i++)
  {
   OutputVar(i);
  }
    
  if ( Request.QueryString["autoSubmit"] !=  null )
   Response.Write("document.getElementById(\"Image1\").click();");

  if ( Request.QueryString["focus"] !=  null )
   FocusVar( Request.QueryString["focus"]);
   
  Response.Write("}");
  Response.Write("</script");
  Response.Write(">");
 }
</script>


  <title>Survey for chat.</title>
  <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
  <meta content="C#" name="CODE_LANGUAGE">
  <meta content="JavaScript" name="vs_defaultClientScript">
  <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 </HEAD>

3. Add parameters to the calling URL like this:

PreChatSurvey.aspx?accountID=1&siteID=1&queueID=3&skipSurvey=no&SmartMax2=" & Session("activeLogin") & "&SmartMax4=" & Session("userEmail") & "&focus=SmartMax7

What this does is allow me to pass values on the URL to fill in the PreChatSurvey with, set which field in the survey has focus and then Autosubmit the survey if I wish, so users are entered directly into Chat mode. 

One other thing to be carefull for is that the on-line and offline Surveys are different and I needed to add a Dummy Label to the off-line survey so the "Subject" field ended up being in the correct spot if the operator is offline and the focused item always works.

I realy think better control of the PreChatSurvey is needed as part of the base software, but until its added this works great and eliminates the need for my users to re-enter there information.

John

 

Top 10 Contributor
Posts 165
eweber replied on 05-16-2006 12:44 AM | 24.249.156.170
John, you are the man! Thanks SO MUCH for sharing your code with our user base.

Eric Weber

Eric Weber, President SmartMax Software, Inc.

Top 10 Contributor
Posts 12
stcu replied on 06-28-2006 9:40 PM | 216.229.170.235

I added your code (per your instructions) and modified the calling URL, but can't seem to get any data to pull in from the querystring.

We are using SightMax version 2.2 presently.

Here's the URL I'm trying to use (domain is modified for security):

https://www.example.com/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=1&queueID=8&skipSurvey=no&SmartMax1=TestName&SmartMax2=123456&SmartMax3=123456&SmartMax4=123456&SmartMax5=123456&SmartMax6=123456

Assuming we can get that working, how do you make it auto-submit?

Thanks for any help you can provide!

Top 50 Contributor
Posts 1
Glenn Gnabasik replied on 07-26-2006 3:24 PM | 71.245.232.230

I found that by adding 'onload="Populate()" to the BODY tag in the PreChatSurvey.aspx did the trick.

 

Top 75 Contributor
Posts 1
jmeessem replied on 09-08-2006 11:29 AM | 207.231.130.10

stcu:
Assuming we can get that working, how do you make it auto-submit?

Looking at John's code, it looks like it's as simple as adding "&autoSubmit=true" to the URL 

Top 10 Contributor
Posts 12
stcu replied on 10-03-2006 2:29 AM | 69.19.14.33
I got it working now.  Thanks for the help!
Top 25 Contributor
Posts 6
matrixIII replied on 05-31-2007 2:32 PM | 63.118.247.4

Hi,

I posted this question in the installation thread with no luck. This feature is currently not possible but if anyone have any creative way of doing this, I would really appreciate hearing about it.

For those of you that have a member database. Lets say that the member logs in. I store the member number in my Session["membernumber"] = "1122334455". Then they click on chat. Is there a way to pipe that information through so that number displays on the operator console. Then the operator would just look at that number and tell the user your order is on the way, you accout balance is 4400.00 without reauthenticating them like.. can I have your user number, can I verfiy your address/phone number, etc.

Now I looked at this solution. If I fill the Name filed with "Act Num: 1122334455" and auto sumit the pre-survey form, that field shows up nicely on the left side of the operator console but the process is not secure. Anyone can go to http://myserver/SightMaxAgentInterface/PreChatSurvey.aspxaccountID=1&amp;siteID=1&amp;queueID=2&amp;SmartMax2=ActNum:88888888.

Now my operator would think that user 88888888 already logged in (which is not the case) and give the user all the info about 88888888 account.

Anyone has any workarounds for this? Some secure way of transfering this data would be very crucial feature for some users!

Thanks

Top 50 Contributor
Posts 2
hamada replied on 07-19-2007 4:38 PM | 70.155.47.238
This does not work with version 4. Did anyone try this solution on version 4. Also the offline and pre-chat surveys are not validating email addresses?? Any help is appricated.
Top 25 Contributor
Posts 3
jpaglier replied on 08-10-2007 1:55 PM | 24.218.43.16

I just installed 4.0 to start testing it, and was able to get this working by just copying the original code I had working in 3.0 to the 4.0 PreChatSurvey form.  Everything works great.  I can populate the Name and e-mail address and then the focus is on the next field waiting for input.  Make sure you take out the "AutoEventWireUp=false otherwise the Page_Load event won't get wired up correctly.

I wish they would make this a standard feature in the API, its been around for a while now and if it was formalized feature it would be much easier for us.

John

Top 10 Contributor
Posts 165
eweber replied on 09-10-2007 10:18 AM | 64.207.249.80

I believe we now have a resolution to this issue that we an support as an official way to prepopulate the prechat survey.  Visit this KB article for full details and code that you can add to your page.

 http://support.sightmax.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=308

 Regards,

 Eric Weber

Eric Weber, President SmartMax Software, Inc.

Page 1 of 1 (10 items) | RSS
Copyright 2006-2009, SmartMax Software, Inc. All Rights Reserved.