Jump to content

Multiple Submits - Ticket Replies


CavalloComm

Recommended Posts

Was wondering if anyone has implemented anything on their save/submit buttons in the support area to prevent the user from clicking the button multiple times. Sometimes the response comes 3 and 4 times because they do this. I know there is jquery code like below, but how would someone implement this in the template?

 

$('#theform').submit(function()
{
   $("input[type='submit']", this)
     .val("Please Wait...")
     .attr('disabled', 'disabled');

   return true;
 });

Link to comment
Share on other sites

If you need to implement it by editing your template it will be very easy,

inside your template/footer.tpl file add the following script at the end, before the closing </body>

 

{literal}
<script type="text/javascript">
$(document).ready(function(){
   $('#frmReply').on("submit", function(){
       var ticketReplyButton = $('#frmReply input[type="submit"]');
           ticketReplyButton.val('Please Wait...');
           ticketReplyButton.attr('disabled', 'disabled');
   });
});
</script>
{/literal}

Link to comment
Share on other sites

With Smarty 3 - is {literal}{/literal} still needed?

somehow I know when I was writing the JS code that you will ask this question!

 

yes it is required, but you can avoid it by placing Space before and after the "{" and "}" brackets, for example the following will give you error:

 

function name(){}

 

but this one will be ok

 

function name() { } 

 

check http://www.smarty.net/docs/en/language.function.literal.tpl

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated