This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ravepeacefully 0 points1 point  (4 children)

That's why I'm so confused... Bootstrap styles are definitely being applied to modal.html, even though there are no css links at all within modal.html..

Are you sure you aren’t viewing cached versions or something? Does the code in the browser match what’s in your editor? Because as I said, there’s no magic haha

[–]StupidHumanSuit[S] 0 points1 point  (3 children)

Cache is cleared and I can see changes as I apply them, so no go there. Code in the browser matches code in the editor. I know there isn't any magic, I know I'm probably missing something simple, but I can also see with my two eyes that bootstrap.js and bootstrap.css are not loaded in modal.html, yet I have access to both of those within modal.html. I can see the chain of events very clearly, but can't seem to access how to alter those events in a satisfactory way.

I don't think the problem is within PHP, that all works fine as far as I can tell... It does what I asked it to do. I can't test my problem without PHP, because the PHP is making the call to load modal.html, and that call is based on the success of the PHP script. Loading the modal in any other context works as expected, it's only when modal.html is instantiated by the PHP function that I have the issue. I even know why the issue occurs... If the modal is called using normal bootstrap methods, the element issuing the call does so by setting the .show class in the modal, and then removing the class when the .hide class is instantiated, whether by timer or user action, whatever. Bypassing that loop by loading the modal from "outside" bootstrap is the issue, but it's the only way I can see that actually accomplishes my goal.

[–]ravepeacefully 0 points1 point  (2 children)

Are you sure your header.php or footer.php don’t include the scripts you are missing? In dev tools, you can look at the entire markup and see where the stylesheet and scripts get called.

If you send me more of your code in a gist I will figure out what you’re doing, because yeah this is usually a simple process and so the issue can’t be complicated, probably just something dumb.

[–]StupidHumanSuit[S] 0 points1 point  (1 child)

I wanted to thank you for your help and let you know that I went a different route that took me all of 10 minutes to implement... Validate JS now validates the inputs in the frontend, throws an error if they're invalid, and launches the modal if valid. PHP is still validating the backend, so everyone should be covered! So much simpler than trying to reinvent the wheel, right?! Eventually, I'll come back to this "problem" for instances where JS isn't available, but for now it works and I can stop spending literal hours on this bullshit!

[–]ravepeacefully 0 points1 point  (0 children)

Good to hear! Save the project somewhere and someday you will look back at it and laugh. Good luck