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 / How to add Bootstrap b...
Power Pages
Answered

How to add Bootstrap button and code

(0) ShareShare
ReportReport
Posted on by 299 Moderator

I've been trying this one all day, to no avail

 

I wanted to test a 'modal' pop up form

 

I know that in the form section in Power Apps, every section has a label where we can add HTML code, although there is a limit, so the code further below won't fit it all 

 

I also tried adding the code in Javascript, however it will always say 'unexpected <', I guess because I'm trying to add HTML to the Form settings Javascript section

 

It also complained about "JSX expressions must have one parent element", although I framed the div area with the below as advised here How to Fix “JSX expressions must have one parent element” in React - Kinsta® Power Pages wouldn't make the modal form work

<React.Fragment> and </React.Fragment>

Where and how would I add the below code so it works? 

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
 Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
 <div class="modal-dialog" role="document">
 <div class="modal-content">
 <div class="modal-header">
 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
 <h4 class="modal-title" id="myModalLabel">Modal title</h4>
 </div>
 <div class="modal-body">
 ...
 </div>
 <div class="modal-footer">
 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
 <button type="button" class="btn btn-primary">Save changes</button>
 </div>
 </div>
 </div>
</div>

 Source of Bootstrap JavaScript · Bootstrap (getbootstrap.com)

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,361 Super User 2025 Season 2 on at

    You can only put HTML directly in a Web Page's Page Copy, Content Snippet, or Web Template; alternatively you would have to write the DOM elements dynamically using JavaScript using document.createElement or JQuery .append() etc.

  • inanoffice23 Profile Picture
    299 Moderator on at

    I have been able to add HTML within the form in the label section, I figured if we can do it in the form's metadata, it should work in the front end and it does

     

    The only limitation is that I can only add that many characters, so for that Bootstrap form it cuts it. I wonder if @EmadBeshai might know how to increase the label limit? --- if we add the HTML into the form's metadata, there is no limit to the amount of HTML we can add, as far as I have tested, so this is no longer a question as it has been solved 🙂

     

     

    HTML sample.png

  • Verified answer
    inanoffice23 Profile Picture
    299 Moderator on at

    I added the Bootstrap code in the metadata's form, where the label is, and it works 🙂 If JS function is needed ensure you add an add event listener or else it won't trigger the JS

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
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard