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 / Button click not firin...
Power Pages
Unanswered

Button click not firing Javascript

(0) ShareShare
ReportReport
Posted on by 179

I’m having problems trying to call javascript from a portal page. Ultimately the button click will run an Azure function.

 

But for now I’ve stripped this right back to basics with a very simple example to display a message when a button is clicked, but nothing happens. I’m missing something obvious I’m sure?

 

The javascript resides in the Custom Javascript section of the Advanced option of the web page

 

 

paulsnolan_0-1614012212615.png

 

 

And the HTML for the button is in the Web Template used by the page

 

paulsnolan_1-1614012212621.png

 

 

And the button appears on the page

 

paulsnolan_2-1614012212623.png

Thanks in advance

 

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Hi @paulsnolan, in Power Apps Portals, we have two Web Pages, a parent/root Web page, and a localized/content Web Page.

    Can you confirm if your JS code is under the Localized/Content Web Page? That's where it should be placed.

    Also, have you cleared the cache? 

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

    As per Oliver's comment, and also make sure that the script has refreshed in the cache (you need to reset the portal cache after each JS update etc).  I think what you have should work, but...

     

    Possibly try dropping the "window." and leave just alert().  You could also try the other method for the onclick (and also the non Jquery with just an onclick in the input tag to get something working)

    $("#inputid").on("click", function(){
     alert("Was clicked.");
    }); 

     

  • paulsnolan Profile Picture
    179 on at

    Hi Oliver

    Thanks for the reply. Yes the change is under the Localized/Content Web Page/Advanced/Custom Javascript. However, the cache hasn't been cleared as I don't have admin rights. Once this is sorted I will let you know the outcome.

  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Another way to clear the cache is using the "Sync Configuration" option from Portal Studio. Go to make.powerapps.com --> apps --> select the Portal App and click Edit

    This will open the Portal Studio, you should be able to see a button for "Sync Config" there.

  • paulsnolan Profile Picture
    179 on at

    Thanks Oliver, yes I can do that no problem, I didn't realize this was what you meant by clear cache, I was trying to use "portal_path/_services/about". Interestingly when one of my colleagues with admin rights navigates to this URL we only see a page with Portals "some guid" and nothing else

  • Verified answer
    paulsnolan Profile Picture
    179 on at

    Hi Fubar, got simple click working, my bad, syntax for click was missing () after the function, school boy error! Used simple non JQuery method. Now onto my real purpose which is calling Azure function from button click. Will return to the original problem re JQuery format once got Azure call working, just trying to prove some functionality which we need. Thank you for your and Oliver's help.

  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Yeah, "sync configuration" and "clear cache" would be sort of the same thing.

    To access the clear cache under the _services/about page, you need to make sure your Contact/User record has the Administrator Web Role associated.

     

    Anyways, I am glad you got it working, can you please mark the solution in case other people are facing the same issue ?

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