Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Marmiuton
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Lasri
Marmiuton
Commits
35c5120d
Commit
35c5120d
authored
Jan 3, 2022
by
Sofiane Lasri
Browse files
Options
Downloads
Patches
Plain Diff
form check validity
parent
f740c3d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pages/client/loginTemp.php
+13
-9
13 additions, 9 deletions
pages/client/loginTemp.php
with
13 additions
and
9 deletions
pages/client/loginTemp.php
+
13
−
9
View file @
35c5120d
...
...
@@ -216,7 +216,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])
</div>
</div>
<button
type=
"button"
id=
"registerBtn"
onclick=
"sendFormData()"
class=
"btn btn-orange"
>
S'inscrire
</button>
<button
type=
"button"
id=
"registerBtn"
class=
"btn btn-orange"
>
S'inscrire
</button>
<input
type=
"hidden"
name=
"recaptcha_response"
id=
"recaptchaResponse"
>
<a
href=
"/Connexion"
class=
"text-orange"
>
Déjà inscrit? 🌈
</a>
</form>
...
...
@@ -225,16 +225,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])
</div>
</div>
<script
src=
"https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"
></script>
<script
type=
"text/javascript"
>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(
function
()
{
'
use strict
'
;
window
.
addEventListener
(
'
load
'
,
function
()
{
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var
forms
=
document
.
getElementsByClassName
(
'
needs-validation
'
);
// Loop over them and prevent submission
document
.
getElementById
(
"
registerBtn
"
).
addEventListener
(
"
click
"
,
function
()
{
if
(
form
.
checkValidity
()
===
false
){
}
else
{
sendFormData
();
}
form
.
classList
.
add
(
'
was-validated
'
);
});
/*
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
...
...
@@ -244,6 +251,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])
form.classList.add('was-validated');
}, false);
});
*/
},
false
);
})();
...
...
@@ -319,11 +327,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])
}
function
sendFormData
(){
if
(
$
(
"
#registerForm
"
).
valid
()){
console
.
log
(
"
Formulaire validé
"
);
}
else
{
console
.
log
(
"
Formulaire invalide
"
);
}
}
</script>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment