0

I have a choice selection. Depending on the users selection I would like to change the text of the SAVE button on the custom form.

Example: What would you like to do from this point?

  • Apply for Support
  • Submit Application

I would like the button to say APPLY on first Choice and SUBMIT on second choice.

1

You simply user javascript or jquery for this. Trigger the change event on dropdown list. In this change event based on the selection value you simple change the Save button text.

1

Please use the onchange event for your requirement

<html>
<head> 
   <script type="text/javascript"> 
     function changeColor() {
    // alert("Hai");
     var eID = document.getElementById("colors"); 
       var colorVal = eID.options[eID.selectedIndex].value; 
     var colortxt = eID.options[eID.selectedIndex].text;
    //alert("Hai"+colortxt);
     document.getElementById('btnSave').value=colortxt ;
    //document.getElementById('btnSave').text=colortxt ;
 } 
  </script>  

    </head> 
   <body>
  <select id="colors" onchange="changeColor()"> <option value="1">Red</option> <option value="2">Blue</option> <option value="3" >Green</option> <option value="4">Yellow</option> <option value="5">Orange</option> <option value="6" selected="selected">White</option> </select> <br><br> 
     <input type="button" id="btnSave"  text="Submit"  >
      </body>
  </html>
  • Thanks Tarlin. I will look at this and try it tomorrow. I will get back to you. – garvon-77 Feb 27 '17 at 22:00
  • @garvon-77 have you tested the script. Is it working..? – TARUN Mar 1 '17 at 12:01
  • Cant get it to work in my SharePoint form. – garvon-77 Mar 1 '17 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.