1. Kayako Download customers: we will continue to develop and support Kayako Download beyond July 2017, alongside the new Kayako for existing customers.

    Find out more.

Live Chat - Remaining Characters and Limits ?

Discussion in 'Kayako Desktop' started by Steven Keclik, Feb 3, 2015.

  1. Steven Keclik

    Steven Keclik Member

    Is there any means to extend the limited character count (think this is set to 255 ?) for an initial question through the Kayako Live Chat ?

    And, similarly, is there any means to indicate to the user as to how many characters are remaining as they type their message ?

    Many thanks in advance.
     
  2. Gary McGrath

    Gary McGrath Staff Member

    Hi there Steven,

    The limit on the actual page comes from your chatlandingpage, the code is

    Code:
    
    <td align="left" valign="middle"><textarea name="subject" id="chatsubject" class="swifttextwide" rows="2" cols="30" maxlength="255"><{$_subject}></textarea></td>
    
    
    however if you just increase that, I am pretty sure that still wont work, as that limit is also present on the actual database table, as the subject is set to varchar( 255 )

    so you would have to also edit the database field structure and allow a bigger value, and I would highly recommend not editing the database

    Gary
     
  3. Steven Keclik

    Steven Keclik Member

    Thanks Gary.
    That makes sense. I'm not about to start changing the data field lengths, etc. But good to know the limitation.

    Is there any means of introducing a counter (i.e. '100 characters remaining...') as a user inputs their question ?

    Thanks again.
     
  4. Gary McGrath

    Gary McGrath Staff Member

    Hi Steven,

    Yes you can do that, you will need to edit a few lines in the chat landing page though. I have copied and pasted the edited template here

    Code:
    
    <{RenderTemplate name="chatheader"}>
    <form name="chatform" id="chatform" method="post" action="<{$_baseName}><{$_templateGroupPrefix}>/LiveChat/Chat/Start" target="_top" enctype="multipart/form-data" onsubmit="return ValidateChatForm(false);">
    <{if $_promptType == 'call'}><{$_language[livechatheadercall]}><{else}><{$_language[livechatheader]}><{/if}><br /><br />
    <input type="hidden" value="1" name="departmentid" class="swiftselect">
    <table width="100%"  border="0" cellspacing="1" cellpadding="2">
     <tr>
     <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
     <td>&nbsp;</td>
     </tr>
     <{if $_getFullName == ""}>
     <tr>
     <td class="fieldtitle" align="left" valign="middle"><{$_language[fieldfullname]}></td>
     <td align="left" valign="middle"><input type="text" name="fullname" id="chatfullname" class="swifttext required" value="<{$_fullName}>"></td>
     </tr>
     <{/if}>
     <{if $_getEmail == ""}>
     <tr>
     <td class="fieldtitle" align="left" valign="middle"><{$_language[fieldemail]}></td>
     <td align="left" valign="middle"><input type="text" name="email" id="chatemail" class="swifttext required email" value="<{$_email}>"></td>
     </tr>
     <{/if}>
     <{if $_promptType == 'call'}>
     <tr>
     <td class="fieldtitle" align="left" valign="middle"><{$_language[fieldphone]}></td>
     <td><select name="countrycode" class="swiftselect required"><{foreach key=key item=_item from=$_countryList}><option value="<{$_item[value]}>"<{if $_item[selected] == true}> selected<{/if}>><{$_item[title]}></option><{/foreach}></select></td>
     </tr>
     <tr>
     <td class="fieldtitle" align="left" valign="middle">&nbsp;</td>
     <td><input type="text" name="phonenumber" id="phonenumber" class="swifttext required" value="" /></td>
     </tr>
     <{/if}>
     <{if $_getSubject == ""}>
     <tr>
     <td class="fieldtitle" align="left" valign="middle"><{$_language[fieldchatsubject]}></td>
     <td align="left" valign="middle"><textarea name="subject" onkeyup="textCounter(this,'counter',255);" id="chatsubject" class="swifttextwide" rows="2" cols="30" maxlength="255"><{$_subject}></textarea></td>
     </tr>
    <tr align="left" valign="middle"><td></td> <td>Max Length: <input disabled  maxlength="3" size="3" value="255" id="counter"></td> </tr>
     <tr>
     <td colspan="2">&nbsp;</td>
     </tr>
     <{/if}>
     </table>
     <{RenderTemplate name="customfields"}>
     <table width="100%"  border="0" cellspacing="1" cellpadding="2">
     <tr>
     <td width="100" class="fieldtitle" align="left" valign="middle">&nbsp;</td>
     <td align="left" valign="middle"><input type="submit" class="rebuttonblue" value="<{if $_promptType == 'call'}><{$_language[callme]}><{else}><{$_language[buttonstartchat]}><{/if}>" /></td>
     </tr>
     <tr>
     <td colspan="2">&nbsp;</td>
     </tr>
     <tr>
     <td colspan="2"><div id="chaterror" class="errorrowhidden"><{$_language[requiredfieldempty]}></div><div id="chatemailerror" class="errorrowhidden"><{$_language[emailinvalid]}></div></td>
     </tr>
    </table>
    <{if $_getFullName != ""}><input type="hidden" name="fullname" value="<{$_getFullName}>"><{/if}>
    <{if $_getEmail != ""}><input type="hidden" name="email" value="<{$_getEmail}>"><{/if}>
    <{if $_getUserID != ""}><input type="hidden" name="userid" value="<{$_getUserID}>"><{/if}>
    <input type="hidden" name="sessionid" value="<{$_getSessionID}>">
    <input type="hidden" name="prompttype" value="<{$_promptType}>">
    <input type="hidden" name="filterdepartmentid" value="<{$_filterDepartmentID}>">
    </form>
    <{RenderTemplate name="chatfooter"}>
    <script>
    function textCounter(field,field2,maxlimit)
    {
     var countfield = document.getElementById(field2);
     if ( field.value.length > maxlimit ) {
      field.value = field.value.substring( 0, maxlimit );
      return false;
     } else {
      countfield.value = maxlimit - field.value.length;
     }
    }
    </script>
    
    
    That will add your char count down.

    Gary
     
  5. Steven Keclik

    Steven Keclik Member

    Fantastic - thanks Gary.
    Will look to introduce and implement as provided.
    Thanks again.
     

Share This Page