Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Changing Text of Next Button

Hello,

I am attempting to change the text from the Next button to read Submit on the final page.

I have taken Perlscript that I found from another post on the forum, but it's not working for the Submit portion unfortunately.

This is what I currently have:

[%Begin Unverified Perl  
 if(PAGENUMBER() < 3)  
  {  
   return "Start the Survey";  
  }
 elsif(PAGENUMBER() == TOTALPAGES() - 1)  
  {  
   return "Submit";  
  }
 else  
  {  
   return "Next &gt;&gt;";  
  }
End Unverified%]

Any help would be great!
asked Oct 19, 2018 by anonymous

1 Answer

+1 vote
Your code will successfully create one of three strings based on the current page number, but we still need to hook it up to the next button somehow.  Here's a simple example of code I placed in my survey's HTML head tag to do so:

<script>
$(document).ready(function(){
    $('#next_button').text('hello world');
})
</script>


Now let's just put your script into mine:

<script>
$(document).ready(function(){
    $('#next_button').text('[%Begin Unverified Perl  
    if(PAGENUMBER() < 3)  
    {
        return "Start the Survey";  
    }
    elsif(PAGENUMBER() == TOTALPAGES() - 1)  
    {
        return "Submit";
    }
    else
    {
        return "Next >>";
    }
End Unverified%]');
})
</script>
answered Oct 19, 2018 by Zachary Platinum Sawtooth Software, Inc. (108,875 points)
...