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.

  2. The forum you are viewing relates to Kayako Classic. If you signed up or upgraded to the new Kayako (after the 4th July 2016), the information in this thread may not apply to you. You can visit the forums for the new Kayako here.

TicketSubject -- submitticket_form

Discussion in 'Style and design' started by Cindy K., Oct 30, 2013.

  1. Cindy K.

    Cindy K. Member

    I have created custom fields and hid the Subject and Message from the ticket body for varies department. In this modified template, I used "space" to by pass the mandatory requirement. But in the Saff portal, the mail/ticket Subject will not be visible. Is there a way that I can hide the subject but still have the subject display in staff portal for the ticket subject? If possible, I would like to use "tickettypeid" to apply for different departments. Thank you.
     
  2. Gary McGrath

    Gary McGrath Staff Member

    Hi there,

    You can use an inline style tag to hide the field, but also ensure it has a value, e.g.

    <input name="ticketsubject" type="text" size="45" class="swifttextwide" id="ticketsubject" type="hidden" value="My Subject title"/>

    Gary
     
    Cindy K. likes this.
  3. Cindy K.

    Cindy K. Member

    Hi Gary,

    Thank you for your reply.

    I am not sure if the value="My Subject title"/> can be replaced to other value or not. If possible, I would like to link to one of my custom fields value to display on the Subject result. In this case, I can see it from the staff portal when ticket arrived. (Instead of the fix value "My Subject Title"). Sorry, I am a beginner of html coding, if I misunderstand the above coding. Please correct me. And, if you can also provide more detail of the html code would be very appreciated.

    Cindy
     
  4. Gary McGrath

    Gary McGrath Staff Member

    Hi there Cindy,

    This is doable, but it will take a couple of tweaks.

    Admin CP -> templates -> General -> Open the "customfields" template

    Near the top ( about line 14 )

    Look for this line:

    Code:
     
        <input name="<{$_customField[fieldname]}>" type="text" autocomplete="off" size="20" class="swifttextlarge" value="<{$_customField[fieldvalue]}>">
     
    
    add into this:

    id="<{$_customField[fieldname]}>"

    So it ends up looking like this:

    Code:
     
        <input name="<{$_customField[fieldname]}>" id="<{$_customField[fieldname]}>" type="text" autocomplete="off" size="20" class="swifttextlarge" value="<{$_customField[fieldvalue]}>">
     
    
    Admin CP -> Templates -> Tickets -> Open the "submitticket_form" template

    At the top line in the <form method blahblah, add this:

    onsubmit="DoSubmit()"

    so it looks like this:

    Code:
     
    <form method="post" onsubmit="DoSubmit()" action="<{$_baseName}><{$_templateGroupPrefix}>/Tickets/Submit/Confirmation" name="SubmitTicketForm" enctype="multipart/form-data" autocomplete="off">
     
    
    Now scroll to the bottom of this template, and add the following code

    Code:
     
    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("5wxhjjb3b9").value;
      return true;
    }
    </script>
     
    

    However, please note you need to alter this code, you need to change 5wxhjjb3b9 to the id of the customfield you want the subject to be changed to. ( you can get this odd number by viewing the submit ticket form in google chrome, and right click on the custom field in question, and select inspect element.

    Gary
     
  5. Cindy K.

    Cindy K. Member

    Hi Gary,

    Thank you for the coding.

    I finished the first three steps but got lost in the last step. Is the odd number has fixed length? When you said "right click on the custom field in "question", what does this mean? And, is this something under the submitticket_form in the admin CP?

    Cindy
     
  6. Gary McGrath

    Gary McGrath Staff Member

    Hi Cindy,

    Actually goto the support centre front end ( like an end user ) and click on submit ticket, so the form displays. Now find the custom field displayed here which you want to use as your subject, right click on its text box, and select inspect element.

    In the next screen that pops up, you will see the "odd numbers" which you will need to use in that last code bit in the final step.

    Gary
     
  7. Cindy K.

    Cindy K. Member

    Dear Gary,

    Yes, I found it. I will give it a try.

    Further to the question, if I have different departments and will have the different customfield want to display in the subject. How should I set this up? I have been tried to add different group templates, but for some reason, all the department forms applied to the default template form. I have been told only need one template, is this true?

    Cindy
     
  8. Gary McGrath

    Gary McGrath Staff Member

    Hi Cindy,

    I am not understanding why you really need this, you have a unique name for subject per department, which comes from a custom field you wish the user to fill in???

    I am starting to think this sounds like your making something far more complicated than it needs to be.

    Maybe you should explain more fully your setup and what your trying to do, and maybe there is a better way to achieve it.

    ( n.b. it is also possible to amend the code I gave to work with multiple departments and custom fields, but lets make sure its the right way to go first )

    Gary
     
  9. Cindy K.

    Cindy K. Member

    Okay. Let me explain this a little bit more. We have 4 departments for user to submit requests. We are only use custom fields to all the department tickets to replace Google Form we currently use. We also track result in the reports for all tickets include all custom fields value to be able to export as a CSV sheets. (I will need some assistance for this later.) Because we have no control of the value that user may enter into the subjects. Therefore, originally, we are trying to hide the subject and message fields that we don't need user to fill in. But after we discovered in the staff portal, we need some information for identifying tickets. That is why I try to copy one of the custom fields value to display for this ticket. Because we have different department tickets with different custom fields, I will need to know how to do for all. Hope this is clear enough for you.
    Cindy
     
  10. Cindy K.

    Cindy K. Member

    Hi Gary,

    Any suggestion from above setup? Should I still amend the code for multiple departments and custom fields? This is my last step to finish my template.

    Thank you.
    Cindy
     
  11. Cindy K.

    Cindy K. Member

    Hi Gary,
    I am still waiting for if you can help me with amending the code with multiple departments and custom fields.

    Any luck?:rolleyes:
    Cindy
     
  12. Gary McGrath

    Gary McGrath Staff Member

    Hi Cindy,

    I will try and get something done on this today for you, I have been away the past couple of days.

    Gary
     
  13. Cindy K.

    Cindy K. Member

    Hi Gary,

    Thank you for reply. I have another question may relate to this.... but I don't know how to attach an image to you. How can I generate an URL for insert the file?
    Cindy
     
  14. Gary McGrath

    Gary McGrath Staff Member

    Hi Cindy,

    RE for multi department, you just need to change the bottom part of the code, you will need to do something like this:

    Code:
     
    <{if $_selectedDepartmentTitle == "General"}>
    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("5wxhjjb3b9").value;
      return true;
    }
    </script>
    <{/if}>
     
    
    And simply repeat the code block for the required departments, and for each department, ensure you have the correct "odd number"

    RE the image thing, do you mean on the forums here, or on the helpdesk?

    Gary
     
  15. Cindy K.

    Cindy K. Member

    Thank you Gary!
    I am trying to upload an image (screenshot) here for the question I have. I have pop-up blank comment box for all the tickets in the staff portal when the mouse slide over the ticket subject line. If you know what I meant, I will not need to upload the screenshot for you.
    Cindy
     
  16. Gary McGrath

    Gary McGrath Staff Member

    I think you are referring to the ticket preview, if you goto admin CP, settings, tickets, look for "Show ticket preview when hovering", and change it to no if you don't wish it to display.

    Gary
     
  17. Cindy K.

    Cindy K. Member

    Yes, It works. Thank you!!!

    And, for the code to add to the buttom, I am not sure where should I start to insert or do I need to remove the previous code.

    Shoul I just replace the below code I added earlier and keep everything the same?

    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("5wxhjjb3b9").value;
    return true;
    }
    </script>

    Cindy
     
  18. Gary McGrath

    Gary McGrath Staff Member

    Hi Cindy,

    Remove the old <script> blah blah </script>

    Then add in the new code I pasted, you can copy and paste the new code as many times as you need to, for all your departments

    Gary
     
  19. Cindy K.

    Cindy K. Member

    Hi Gary,

    I removed the previous code and put the new code after the <{if$_can IRS==true}>blah blah </div>
    I am not sure where went wrong, the ticket didn't show its value in the subject line.

    <{if $_canIRS == true}>
    <script type="text/javascript">
    StartIRS();
    </script>
    <{/if}>
    </div>

    <{if _selectedDepartmentTitle = "Purchase Request"}>
    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("0x1y8mtjypa4").value;
    return true;
    }
    </script>
    <{/if}>
    <{if _selectedDepartmentTitle = "Book Room Request"}>
    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("bdyb41cuh4xd").value;
    return true;
    }
    </script>
    <{/if}>
    <{if _selectedDepartmentTitle = "Article Request"}>
    <script>
    function DoSubmit(){
    document.getElementById("ticketsubject").value = document.getElementById("2kxidvqa7o3g").value;
    return true;
    }
    </script>
    <{/if}>


    </form>
     
  20. Gary McGrath

    Gary McGrath Staff Member

    My bad typo, it needs to be == ( not a single = )

    e.g.

    <{if $ _selectedDepartmentTitle == "Purchase Request"}>
    <{if $_selectedDepartmentTitle == "Book Room Request"}>
    <{if $_selectedDepartmentTitle == "Article Request"}>

    Edit: also make sure you have $ _selectedDepartmentTitle and not _selectedDepartmentTitle
    Gary
     

Share This Page