mercredi 22 septembre 2021

HTML validation works on codepen but not on my laptop or IIS

First question but I've been using the site for over 8 years so please bear with me. All help is greatly appreciated. I've spent a couple of days and far too many hours now on this.

I have a web page that uses the default HTML validation via the input element required. In codepen the "message" is displayed if I don't populate the field. I added css to also make the background yellow. In codepen everything works great but on my laptop I get the yellow background but the majority of the inputs don't show the message. What's really strange is that some of them will give the message but the majority don't. I even have three within the same div and one gives the message while the other two don't. Same exact code except for the id & name. I know it recognizes the validation error because it triggers the css to change the background (input:invalid:focus), scrolls to it but no message.

I thought maybe it was my code so I exported the codepen and ran it from the unzipped /dist folder. Same behavior as the original code on my laptop. I emailed codepen and when they export and run from the /dist folder all of the fields show the message for them. I pushed it out to an IIS server and I get the same behavior as I do on my laptop, some messages display and some don't.

There aren't any errors in the console either. I'm at a loss. The code is too large to include and if I put a link to the codepen it forces me to include the code. I'm using Chrome 94. I ran the HTML through the W3C markup service and no errors. The codepen HTML does contain errors from the W3C markup service but still works whereas the HTML with no errors locally doesn't.

codepen: codepen shows the message

local (exported codepen): local no message but scrolls to it & changes background




Aucun commentaire:

Enregistrer un commentaire