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

Announcements

News and Announcements icon
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 517

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
    517 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
    517 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
    517 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,514 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
11manish Profile Picture

11manish 129

#2
Subra Profile Picture

Subra 126

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 101 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans