cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
QuantumRemedy
New Member

JavaScript library CDN only works in modal entity form when logged in as an administrator

I set up a modal entity form that needs multi-select capability so I added CDN references to "select2" in my page and used it in the Entity Form's custom JavaScript. This was working great for me in one environment but when I moved it to a new environment, it didn't work. The first environment my account had the Administrator web role, but the second one did not. I can recreate this issue every time by removing the Administrator web role.

 

I can also see in the sources in the browser that when I'm an Administrator, there's a reference created to /js/select2/select2.min.js in my *.powerappsportals.com. I don't have a folder and I didn't set this up. I also don't see that when I take away my Administrator role. I'm assuming maybe that is caching, but I don't understand why this works as an Administrator and not when I take away that web role from my account.

 

The CDN style and script I'm linking to are here: Installation | Select2 - The jQuery replacement for select boxes It works great anywhere else too, it just doesn't work on this modal entity form unless I'm an Administrator. This is baffling me and I need this functionality to work for other users.

1 ACCEPTED SOLUTION

Accepted Solutions
Fubar
Solution Sage
Solution Sage

Not aware of this issue,  but a possible workaround is rather than doing it directly on the Entity Form, did you try putting it in a Web Resource embed the Web Resource on your entity form and then set the render Web Resources setting on the Entity Form definition.   (we do a Google address typeahead lookup in this manner and then update address fields on the main Entity Form when the user selects a value)

 

View solution in original post

2 REPLIES 2
ragavanrajan
Super User
Super User

Hi @QuantumRemedy,

 

   I am not sure this will help you. Select2 is really a good library and it has nice components to utilize. Probably because it is JS CDN, by default .JS extension is blocked in Portal. So I am thinking that is the reason it is expecting an admin role in your entity form.  There is a high chance of vulnerability and an injection attack can occur if you enable .js extension in the portal. Maybe I am wrong here. 

 

An alternative approach if you are interested.  I use bulma.css in our portal a lot. Most of the components can work just with CSS only which is fab and makes your job easy. Adding the post reference below. 

 

https://powerusers.microsoft.com/t5/Power-Apps-Portals/Portal-Theme-Bootstrap-Version/m-p/792736 

 

 

Hope it helps. 

------------

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.

Fubar
Solution Sage
Solution Sage

Not aware of this issue,  but a possible workaround is rather than doing it directly on the Entity Form, did you try putting it in a Web Resource embed the Web Resource on your entity form and then set the render Web Resources setting on the Entity Form definition.   (we do a Google address typeahead lookup in this manner and then update address fields on the main Entity Form when the user selects a value)

 

View solution in original post

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.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Users online (69,120)