cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinPAChamp
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

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

@hardikv 

Perfect  working lovely now thank you so much 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,598)