CavalloComm Posted November 12, 2015 Share Posted November 12, 2015 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; }); 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 12, 2015 Share Posted November 12, 2015 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} 0 Quote Link to comment Share on other sites More sharing options...
CavalloComm Posted November 12, 2015 Author Share Posted November 12, 2015 With Smarty 3 - is {literal}{/literal} still needed? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 12, 2015 Share Posted November 12, 2015 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 0 Quote Link to comment Share on other sites More sharing options...
CavalloComm Posted November 12, 2015 Author Share Posted November 12, 2015 OK! I appreciate it! I'm trying to keep learning all of this.. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.