Comments (19)
Thank you daveh for all your support:)!
from php-signup-login.
And i make it in validation.js:
validation
.addField("#name", [ { rule: "required" }, { rule: "name" }, { validator: (value) => () => { return fetch("validate-name.php?email=" + encodeURIComponent(value)) .then(function(response) { return response.json(); }) .then(function(json) { return json.available; }); }, errorMessage: "Name already taken" } ])
But it won't work
from php-signup-login.
In what way doesn't it work? Do you get any error messages? Try debugging the code by inserting debugging statements to print out the values of the variables at different stages
from php-signup-login.
Hello daveh,
Thank you for response!
It seems like just the validate-name.php be skipped when the button be pressed in register window. No errors. Did I need connect the validate-name.php with process-signup or something like that? Or need write specific code for name checking? Thanks:)
from php-signup-login.
In your JavaScript, you're passing the name value in the query string with an index of "email":
return fetch("validate-name.php?email=" + encodeURIComponent(value))
but then getting this on the server with an index of name: $_GET["name"]
Try changing them so they match, e.g.
return fetch("validate-name.php?name=" + encodeURIComponent(value))
from php-signup-login.
I already do it, but still didn't work
from php-signup-login.
Check the browser console to see what JS requests are being made, and if there are any errors
from php-signup-login.
That's I've got when I pressed signup button
From console I've got nothing
from php-signup-login.
From that it looks like the JavaScript validation isn't running when you submit the form. Check the code that attaches the validation to the form, it could be that.
from php-signup-login.
It seem the validation is attached, but from now when I go to the signup.html page it show error in console:
A somehow the code didn't change in website
This code from vs studio:
const validation = new JustValidate("#signup");
validation
.addField("#name", [
{
rule: "required"
},
{
rule: "name"
},
{
validator: (value) => () => {
return fetch("validate-name.php?name=" + encodeURIComponent(value))
.then(function(response) {
console.log("Server Response:", response); // Add this line
return response.json();
})
.then(function(json) {
return json.available;
});
},
errorMessage: "Name already taken"
}
])
.addField("#email", [
{
rule: "required"
},
{
rule: "email"
},
{
validator: (value) => () => {
return fetch("validate-email.php?email=" + encodeURIComponent(value))
.then(function(response) {
return response.json();
})
.then(function(json) {
return json.available;
});
},
errorMessage: "email already taken"
}
])
.addField("#password", [
{
rule: "required"
},
{
rule: "password"
}
])
.addField("#password_confirmation", [
{
validator: (value, fields) => {
return value === fields["#password"].elem.value;
},
errorMessage: "Passwords should match"
}
])
.onSuccess((event) => {
document.getElementById("signup").submit();
});
And what code I see in chrome:
const validation = new JustValidate("#signup");
validation
.addField("#name", [
{
rule: "required"
}
])
.addField("#email", [
{
rule: "required"
},
{
rule: "email"
},
{
validator: (value) => () => {
return fetch("validate-email.php?email=" + encodeURIComponent(value))
.then(function(response) {
return response.json();
})
.then(function(json) {
return json.available;
});
},
errorMessage: "email already taken"
}
])
.addField("#password", [
{
rule: "required"
},
{
rule: "password"
}
])
.addField("#password_confirmation", [
{
validator: (value, fields) => {
return value === fields["#password"].elem.value;
},
errorMessage: "Passwords should match"
}
])
.onSuccess((event) => {
document.getElementById("signup").submit();
});
But I don't know it make a sence.
But the error can be solution
from php-signup-login.
If JustValidate is not defined, then it looks like that library isn't being loaded. Check the network console to see if there is an error when requesting that file, or make sure you're loading that file before your own one.
from php-signup-login.
I added this line in signup.html:
<script src="https://unpkg.com/[email protected]/dist/js/just-validate.min.js"></script>
And now in network console show this:
Now it seems the validation.js is working but show the just-validate.min.js been failed it when you pressed on the just-validate.min.js text it in next page show this:
It can be the version problem but I don't know how to get normal link with normal version ( I get it from ChatGPT)
But when you enter already create name it still allow to signup
from php-signup-login.
You can get it from the official website:
<script src="https://unpkg.com/just-validate@latest/dist/just-validate.production.min.js"></script>
from php-signup-login.
Yea it work with js!
But still allow to use already taken name
from php-signup-login.
Try debugging by seeing what value is being returned from the script that checks the email address and returns a value to the JavaScript
from php-signup-login.
Now I tried in localhost Host and it seems the website signup.html see validation normally because in website Host it just validation look like this .addField("#name", [ { rule: "required" } ])
instead looking like this:
.addField("#name", [ { rule: "required" }, { rule: "name" }, { validator: (value) => () => { return fetch("validate-name.php?name=" + encodeURIComponent(value)) .then(function(response) { console.log("Server Response:", response); // Add this line return response.json(); }) .then(function(json) { return json.available; }); }, errorMessage: "Name already taken" } ])
In local host I'm getting signup.html console error:
Uncaught Error: Rule should be one of these types: required, email, minLength, maxLength, password, number, integer, maxNumber, minNumber, strongPassword, customRegexp, minFilesCount, maxFilesCount, files. Provided value: name at just-validate.production.min.js:1:18898 at Array.forEach (<anonymous>) at Object.addField (just-validate.production.min.js:1:18676) at validation.js:4:6
And I cant press signup button:
validation.js 4 line:
` .addField("#name", [`.
PS: In both places (LocalHost , Website Host):
Read the validate-name.php: because when I enter websitename.com/path/path2/validate-name.php?name=5353
I'm getting this:
from php-signup-login.
Perhaps the syntax has changed in a more recent version of JustValidate - the documentation is here.
from php-signup-login.
It work:)! But small problem: How why when I press the signup button without writting email address in email area. It just say email already exits if I didn't not write anything
from php-signup-login.
Try debugging the script that checks the emails by running the PHP code directly with an empty string for the email address. You can run the PHP script directly by requesting it in the browser's address bar, passing the email in the query string. You can print out debugging statements to see what values the various statements in the PHP are returning, to see where the issue is.
from php-signup-login.
Related Issues (18)
- Not able to display the message "email already exist" HOT 5
- login form doesn't recognise password array key HOT 2
- JustValidate doesn't work HOT 4
- Fatal error: Uncaught mysqli_sql_exception: Duplicate entry '[email protected]' for key 'email' HOT 3
- issue with password validation HOT 4
- Issues with process-signup file, database connection HOT 2
- Validation from validation.js isn't working. HOT 1
- Email Already Taken HOT 26
- Signup Parse Error HOT 2
- Prevention of Duplicate Emails Not Working Properly HOT 4
- Signup doesnt work HOT 2
- Signup is not working properly. HOT 8
- I have a error for this line can you help me thankyou! HOT 1
- Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in C:\xampp\htdocs\php-signup-login-main\login.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\php-signup-login-main\login.php on line 15 HOT 1
- return $mysqli; Fatal error: Uncaught Error: Call to a member function real_escape_string() on int in C:\xampp\htdocs\ByteGames.ltForumas\Forumas\testuojame123\validate-email.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\ByteGames.ltForumas\Forumas\testuojame123\validate-email.php on line 7 HOT 1
- Error message location HOT 1
- Undefined array key "email" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-signup-login.