web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / How to Show/Hide Multi...
Power Pages
Unanswered

How to Show/Hide Multistep Form Fields based on the Previous Step Selection?

(0) ShareShare
ReportReport
Posted on by 57

I have Multi step Form consisting 4 Step:

 

In Step 1 I have Multi Select field name - "Care Type".

When Care type is Home or Office

  • then In Step 4 I want to show and hide some fields!

 When I try to write JavaScript function, I didn't get DOM Element from Previous Step or Next Step. How to achieve this?

Categories:
I have the same question (0)
  • Lorne_PEI Profile Picture
    39 on at

    I would try assigning the record to a variable using Liquid.  Once in a variable it will expose all the fields and their values.  Then you can use Liquid and Jquery to hide your fields.

     

    {% assign id = request.params.id %}
    {% assign project = entities.my_table[request.params.id] -%}
    {% if project.my_field.value == 923190001 %}
    $("some_field").hide();
    {% endif %}
     
  • Dhruvin Shah Profile Picture
    57 on at

    Hi!

    Thanks for the quick response! I have New Form!

    I have Multi Step Form

     

    Dhruvin_0-1679225356763.png

     

     

    I'm loading the tab as a Step

    Dhruvin_1-1679225454927.png

     

    Now, where can I write this Logic! My Record is not submitted yet!

    In Step 3 I need Step 1 record value to show hide field!

  • Lorne_PEI Profile Picture
    39 on at

    You need to place the code in Step 3 under Form Options there's a JavaScript box.  Wrap it in a document.ready block.

  • Dhruvin Shah Profile Picture
    57 on at

    Thanks a lot! Let me try!

  • Dhruvin Shah Profile Picture
    57 on at

    @Lgallair  - I have New form for every step !

    How can I get {% assign id = request.params.id %} ??

    because I've no parameter for the current record?

  • Lorne_PEI Profile Picture
    39 on at

    On your first step, set your record source to Query String and your String Parameter Name to id.  And then each subsequent step set it to Results from previous step.

  • Dhruvin Shah Profile Picture
    57 on at

    @Lgallair - I tried this way by changing the settings!

    Only thing is I'm not getting ID from previous step! because all my forms are Insert form from same table and loading tabs here as step!

    Dhruvin_1-1679275482156.png

    Please see the setting changed!

     

    Dhruvin_0-1679275345701.png

     

    When I try to add Liquid Code, it is returning me blank value for ID

     

  • Lorne_PEI Profile Picture
    39 on at

    With the exception of Step 1; which should be Insert, change the mode to Edit on all other steps.

  • Fubar Profile Picture
    8,344 Super User 2025 Season 2 on at

    If the Steps are for the same table, usually the first step would be Insert and subsequent ones Edit.  On the scenario where it is the same record on different steps you can just add the field on your dataverse form for the subsequent steps (then create a step Metadata record and add a CSS class to hide it) and then use JQuery/JavaScript to Hide fields etc.

     

    In the Scenario where you are creating multiple records, you may have to store the value(s) in local storage using JavaScript on the previous step and then retrieve them on the subsequent steps.

  • Shig Profile Picture
    29 on at

    Hey Team,

     

    I was also trying to hide some fields based on the user inputs from step one.

    By using the below code, it was only hiding the field input box, and the label was visible.

    $("#af_colk").hide(); 

     So I used this code.

    $("#af_colk").hide(); $("#af_colk_label").hide();

    And it hides both label and the input box by leaving some blank spaces in the form.

     

    I have a lot of cases to check and hide/show a lot of columns, so my code exceeds 15000 characters. And the custom JavaScript box only accepts till 10000 characters. To handle this situation, I am now trying to use CSS class. 

    So I created step Metadata record, and under control style -> CSS class, I added the class name.

    Shig_0-1713793146009.png

    JQuery I used:

    $('#aircurtain').hide();

     This code was not working for me.

    Can you help me to figure out what I am doing wrong here?

     

    @Fubar @Lgallair @Dhruvin 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard