Password HTML Script

User 2836110 Photo


Registered User
109 posts

I created the following HTML for a password box with some validation.

<html>
<head>
<title>Password</title>
<script>
function checkPassword() {
var password = document.getElementById("passwordBox");
var passwordText = password.value;
if(passwordText == "FarmTronics") {
return true;
}
alert("Access denied! Incorrect password!");
return false;
}
</script>
</head>
<body>
<p style="font-size: 30pt;">FarmTronics Australia</p>
<p>Please enter the password to view this website.</p>
<p>Password:<input id="passwordBox" type="password"/></p>
<a href="https://farmtronics.com.au" onclick="return checkPassword();">
Click here to submit password and view website
</a>
</body>
</html>

But when i paste it into a HTML Element in WFB it changes to the following:
And i cannot figure out why this is happening ??

<p style="font-size: 30pt;">
FarmTronics Australia
</p>
<p>
Please enter the password to view this website.
</p>
<p>
Password:<input id="passwordBox" type="password"></input>
</p> <a href="https://farmtronics.com.au" onclick="return checkPassword();">Click here to submit password and view website</a>
User 187934 Photo


Senior Advisor
20,193 posts
Online Now

Hi Lou,
Don't use the html, head ,title, and body tags in your html element.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2836110 Photo


Registered User
109 posts

Wow Eric,
That was an easy fix, i bow to the master once again.
User 187934 Photo


Senior Advisor
20,193 posts
Online Now

Lou Mitsy wrote:
Wow Eric,
That was an easy fix, i bow to the master once again.
:lol:
Glad to help.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2836110 Photo


Registered User
109 posts

Thanks again Eric,
It would be easier if WFB had a few more options for the Password Element.
Including the validation and the actual password, rather than just asterisks.
Maybe in the future.
User 187934 Photo


Senior Advisor
20,193 posts
Online Now

I think CC has kept it simple because it's not a secure way of using passwords.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2836110 Photo


Registered User
109 posts

Yes, that makes sense.
Thanks again Eric.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.