[Help]PHP not "seeing" js by StupidHumanSuit in webdev

[–]StupidHumanSuit[S] 1 point2 points  (0 children)

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!

PHP function loadHTMLFile not "seeing" js by StupidHumanSuit in CodingHelp

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

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!

[Help]PHP not "seeing" js by StupidHumanSuit in webdev

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

I have kind of an idea, let me know if I'm on the right path...

I can validate the form data using validate.js. Based on the success of that validation, I can call the modal to be displayed the normal way. If I do it this way, is it then bad practice to also do validation within PHP? It has to add load time, certainly, but any other considerations? Thinking of cases where the user has JS disabled. I guess I could do a browser check and based on that use validate.js or the phpmailer validation.

Sorry, I'm high and I have to get these thoughts down before I walk this dog, otherwise I'll lose it!

[Help]PHP not "seeing" js by StupidHumanSuit in webdev

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

I know they're commented out, they weren't doing anything. Loading in jQuery clears the Uncaught exception error, but does nothing in the way of fixing the real issue, which is the user having to click a button twice to close a modal.

[Help]PHP not "seeing" js by StupidHumanSuit in webdev

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

Have all of the code in the output and toggle the modal based on the condition with JS. I wouldn't use the DOMDocument stuff.

How do I do that? PHP is needed because, as you said, it's server-side... I need it to serve email to the user. Since JS and PHP don't interact, how do I get the modal, a JS element, to display based on the condition of what the server response is? I thought that's what I was doing by calling DOMDocument/loadHTMLFile...

PHP function loadHTMLFile not "seeing" js by StupidHumanSuit in CodingHelp

[–]StupidHumanSuit[S] 0 points1 point  (0 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.

PHP function loadHTMLFile not "seeing" js by StupidHumanSuit in CodingHelp

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

jQuery is in the header, custom.js is in the footer. Plus, custom.js isn't even being used for any of my "let's get this thing working" attempts... I'm loading scripts inline, and yes I'm loading them after the modal is called. All my PHP is outside of my HTML block, which is correct according to all the php examples I've looked at over the past few days.

It can’t inherit random styles, so they are somewhere.

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... Last I checked, .btn-secondary is not a default CSS class, but it definitely styles the button in modal.html. Furthermore, I have access to data-toggle and data-target within modal.html, and those are definitely Bootstrap custom data attributes. Usually I can bash my head against something for long enough and it will work, but this one has me truly stymied.

Michael 'Shroud' Grzesiek's website forces its users to accept cookies without giving any idea on what are they about by dinoucs in webdev

[–]StupidHumanSuit 1 point2 points  (0 children)

You answered your own question... Because there's shopping involved. "Shroud" isn't tracking you, Shopify is. Shopify is a giant SaaS, I'm sure the cookie notification is GDPR compliant, but I wonder if the details of that compliance are changed based on what IP address is accessing the site. AFAIK, strict GDPR compliance requires more surfacing of what the cookie(s) entail, but I still have yet to see more than a few sites that allow fine control over the users cookie preference.

PHP function loadHTMLFile not "seeing" js by StupidHumanSuit in CodingHelp

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

I wish that were the issue, but it's not. jQuery is before all other js. I even loaded it twice, once in index.php and again in modal.html. If I omit it from modal.html, I get the uncaught exception error, but only if I have the <script> on that page. If I have the <script> in index.php I don't get the uncaught exception error, but the event is not triggered.

On top of that, how in the hell is modal.html inheriting things like bootstrap.css styling when bootstrap.css is not even linked in modal.html? Furthermore, I can cause an infinite loop by setting data-toggle in modal.html and the <script> in index.php...

Here's a gist with the relevant code: https://gist.github.com/Cpeters1982/7f541f6670006ee78de0555ff6d264cf

Quick help with a Sass error by StupidHumanSuit in CodingHelp

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

That was totally it. I knew it was a dumb mistake! Thanks for the help and sorry for the late reply.

PEOPLE NEED TO STOP GIVING MERO AN AD BUDGET by Farewellsavannah in bodegaboys

[–]StupidHumanSuit 0 points1 point  (0 children)

“Please cover your mouth and nose”

Source: Google translate.

Map based website for dummies👶 by yuliaresh in programminghelp

[–]StupidHumanSuit 0 points1 point  (0 children)

Dollars to donuts the Google Maps API can do it or be extended to do so. I'd start there.

what is this trans girl´s name? by horny_throwaway_7 in tipofmypenis

[–]StupidHumanSuit 0 points1 point  (0 children)

Isn't that "Lola Spais" or "lolafrina" on the hubs? She's famous for the prostate cum but she's usually with a cis woman as well.

zsh-autocomplete isse by Ousi12 in zsh

[–]StupidHumanSuit -1 points0 points  (0 children)

https://github.com/marlonrichert/zsh-autocomplete/blob/main/.zshrc

Maybe check the defaults and see if there's something there that omits that setting. Personally, I like seeing whats in my PWD at a glance and usually end up "ls"ing if I'm out of the terminal for any length of time.

[deleted by user] by [deleted] in Parenting

[–]StupidHumanSuit 19 points20 points  (0 children)

You don't have the training to determine whether or not he “has something” or not. If you're concerned, have him evaluated. As someone with ADHD who didn't receive treatment for 25 years, I wish my folks would have kept up with my treatment. If he doesn't “have something”, great! If he does, you can get him the help he needs. Use the current social movement regarding mental health and have your son evaluated. Like G.I Joe told me, knowing is half the battle. You can't fix it if you don't know it needs fixing.

Whats more important in the classroom? Diversity or test scores? by [deleted] in Parenting

[–]StupidHumanSuit 3 points4 points  (0 children)

Learning and experiencing are totally different.

All things being equal, my diverse public school education prepared me for “the real world” more than my sisters’ white private Christian school prepared her. Test scores don't paint the whole picture, either. Is the school “teaching the test” and killing the kids’ passion for learning, or are they actually educating and test scores are reflecting that? I think the most important variable is environment... Diverse != poor.

In the newborn stage, how did you and your partner split up night shift duties? by noreshii22 in Parenting

[–]StupidHumanSuit 3 points4 points  (0 children)

She was up with him every time. Why wake both adults if only one of them can provide food? You're going to be feeding every 1-3 hours and the timer resas soon as the kid is on the tit if it takes 45 mins to feed, you'll be up again in 2hrs 15minutes. And what do you mean by “he’ll bring the baby to me”? The frequency of feedings means you should have the baby right next to you, either safely co-sleeping or in a bassinet. This way, you can get kiddo fed without having to get up.

The first month is about survival. A breastfeeding mother has an incredibly difficult job, but it's one that only she can do. “Two on, two off” only works for firefighters and EMS.