cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Show/Hide Button based on Dropdown selection - Portal Webforms - JavaScript

Hi 

 

I am trying to disable a Submit button based on a dropdown box in a portal webform?

 

Can I do this via JavaScript?

11 REPLIES 11
Highlighted

HI @MartinPAChamp 

 

For onload, you should use below code:

$(document).ready(function(){
	let currentVal = $("#iii_submitted option:selected").val();
	//do some validation
	if(currentVal == "0") {
		$("input[type='button'][value='Submit your Request']").hide();
	} else {
		$("input[type='button'][value='Submit your Request']").show();
	}
 
	$("#iii_submitted").change(function () {
        // Get value of your trigger field
        let currentVal = $("#iii_submitted option:selected").val();
        //do some validation
        if(currentVal == "0") {
            $("input[type='button'][value='Submit your Request']").hide();
        } else {
            $("input[type='button'][value='Submit your Request']").show();
        }
    });
 });

 

Clear cache first and check it.

 

If you like this post, give a Thumbs up. Where it solved your query, Mark as Solution so it can help other people. 

View solution in original post

Highlighted

@hardikv 

Perfect  working lovely now thank you so much 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (7,928)