Hi Becky,
Below is a solution we are using to change the text value of form buttons that have been previously submitted.
It works by creating cookies on submit button click. Then when the page reloads it checks for the cookie. If there is a cookie present it will make the changes.
Instructions
insert the following into a new html page element
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- include jquery if needed -->
<script>
$(document).ready(function(){
setTimeout(function(){
$('.mktoButton').click(function(e){
e.preventDefault();
var myErrors = $(this).closest('form').find('.mktoInvalid').length;
if(myErrors == 0){
var formID = $(this).closest('form').attr('id');
createCookie(formID ,'submit');
console.log(formID);
$(this).unbind('click').click();
}
});
$('form[id]').each(function(){
var formID = $(this).attr('id');
var cookieFormId = getCookie(formID);
console.log(cookieFormId);
if(cookieFormId == 'submit'){
$(this).find('button').text('Thank You');
$(this).find('button').attr('disabled','disabled');
}
});
},3000);
});
var createCookie = function(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
</script>