cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jagadis
Frequent Visitor

OnChange event handler in Dataverse entity form

Hello Guys,

have you used event handlers in entity form? 

My requirement is to on text changed of field on entity form I wanted to disable few fields on the same form. To test with I have added simple javascript code to print "hello world" on change of a field.

but , Javascript function doesn't trigger , so it doesn't happen anything.

 

can you able to share some of your suggestions.

3 REPLIES 3
OliverRodrigues
Super User II
Super User II

Hi, these threads might help:

https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/292094/how-do-you-implement-an-on-...

https://powerusers.microsoft.com/t5/Power-Apps-Portals/Portals-Javascript-Changes-you-made-may-not-b...

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

OOlashyn
Super User
Super User

Hi @Jagadis,

Event handlers in the form itself will not work on the Portal, they work only inside model-driven apps. You would need to add on change triggers in the Custom Javascript section of the form. Your code would look something like this:

$(document).ready(function () {
 // id of the field is its logical name
 $("#title").change(onTitleChange);
});

function onTitleChange() {
 console.log("My title changed");
}

You can find more about working with Javascript for portal in this official doc. In general, I would advise you to google example on using code specifically on entity forms as code design to work inside dataverse won't work on the portal.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.
Fubar
Solution Sage
Solution Sage

Its done often - as per the previous posts. 

Not, sure if it is still the case but we came across an issue for an Entity Form popup (actually inline) rather than on a Web Page, where we had to change the (document).ready to another keyword than 'ready'.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (17,546)