Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

Dynamic validation

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

i'm busy making a multistep form and i encounter the following. i have 4 dropdown menu's dropdown 2,3 and 4 are hidden. based on the selection of dropdown 1, one of the others shows visible. and i used this video for my problem Using JavaScript in Power Apps Portals to Hide and Show Fields - YouTube

 

what i want, is that the field that is visible field should be a required field and the hidden fields are not required.

 

below is the code i have now.

 

 

$(document).ready(function () {
 $("#dropdown_1").change(onDisplaySectionChange);
 onDisplaySectionChange();
});

function onDisplaySectionChange() {
 var varadvies = $('#dropdown_1').find("option:selected").text();
 var verplicht = $('#dropdown_2');

 if (varadvies === "option_1") {
 $('#dropdown_2').parent().parent().show();
 } else {
 $('#dropdown_2').parent().parent().hide();
 $('#dropdown_3').val('');
 $('#dropdown_4').val('');
 }

 if (varadvies === "option_2") {
 $('#dropdown_3').parent().parent().show();
 } else {
 $('#dropdown_3').parent().parent().hide();
 $('#dropdown_2').val('');
 $('#dropdown_4').val('');
 }

 if (varadvies === "option_3") {
 $('#dropdown_4').parent().parent().show();
 } else {
 $('#dropdown_4').parent().parent().hide();
 $('#dropdown_2').val('');
 $('#dropdown_3').val('');
 }
}

 

I tried a few things and searched the forums. and i found (i think) some answers but i am doing something wrong, but i cant figure it out

 

can someone help me out with this?

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >