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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Adding an onclick event to a yes/no on Portal

(0) ShareShare
ReportReport
Posted on by 515

Hi


I want to have a field that appears/disappears if a yes/no is selected or not. - This is something I can do for a D365 form using either JavaScript or a Business Rule.

What is the equivalent functionality for use in the Portal?

Thanks

Lee 

I have the same question (0)
  • Suggested answer
    Torrado Profile Picture
    1,270 on at

    Hello Lee-Martin,

    In your case, you want to have Client-Side logic to modify the visibility of a field, so you need to address that requirement using JavaScript (please check this official article).

    • Example:

    function setFieldVisibility(fieldName, displayStatus) {

      if (displayStatus == "show") {

          $("#" + fieldName).closest("tr").show()

      }

      else if (displayStatus == "hide") {

          $("#" + fieldName).closest("tr").hide()

      }

    }

    • Then you can use the function as following:

    setFieldVisibility("FieldName", "show")

    setFieldVisibility("FieldName", "hide")

    You can of course modify the function to fit your needs.

    Refer also this post: https://community.dynamics.com/365/sales/f/dynamics-365-for-sales-forum/299169/show-or-hide-fields-on-entity-form-on-dynamics-365-portals 

    Hope that this helps you!

  • Lee-Martin Profile Picture
    515 on at

    Thanks

    Do I need to add an onclick event to the form somehow? perhaps using liquid?

  • Torrado Profile Picture
    1,270 on at

    Yes, if that's your requirement, you can call the function from an onclick event.

    Please mark the answer as verified if helpful.

  • Lee-Martin Profile Picture
    515 on at

    Is there information anywhere as to how/where I would amend to the liquid in order to do this?

  • Torrado Profile Picture
    1,270 on at
  • Community Member Profile Picture
    on at

    Hi Lee,

    Two ways you can add custom javascript to the portal.

    1.Go Portal management app.

     Navigate to entity forms to open one you need, and move to 'Additional Setting' tab, then you can add js code to 'Custom Javascript' section.

    pastedimage1618821730598v1.png

    2.Edit portal by administrator.

    You need login the portal with administrator, you will view pane in the top of the page.

    pastedimage1618821884807v2.png

    you can open the page you need, then click 'Edit' button.

    pastedimage1618821939509v3.png

    One dialog will open, you can add js ode under 'Options' tab.

    pastedimage1618821979078v4.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Lee-Martin Profile Picture
    515 on at

    Thanks Leah, but the issue isn't adding JavaScript, it's how to had an onclick to the form object.

    Luckily I've been able to find this elsewhere now.

    Thanks for replying everyone

    Lee

  • Community Member Profile Picture
    on at

    Hi Lee,

    I'm glad your problem has been solved, can you share your solution if possible?

    Regards,

    Leah Ju

  • CRMJetty Profile Picture
    3,512 on at

    Hi Lee,

    In regards to your concern, refer below link to set field visibility based on other field value change in portal:
    https://www.agarwalritika.com/post/toggle-field-visibility-based-on-another-field-in-power-apps-portals

    I hope it helps,

    Thanks.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 80

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans