[SOLVED] [AJAX] Simple Validation
Afgelopen dagen heb ik Simple Validation van Insanity Ville in mijn website geïntegreerd.
Het werkte prima, nu heb ik daarnaast op dezelfde pagina Modalbox van okunet.ru geïntegreerd. Modalbox werkt prima, maar nu doet de Simple Validation het niet meer.
Chrome en Firebug geven dit terug:
Code (php)
1
2
3
4
2
3
4
Uncaught TypeError: Cannot call method 'blur' of null
jQuery.jQuery.extend._Deferred.deferred.resolveWithjquery.js:869
jQuery.jQuery.extend.readyjquery.js:420
jQuery.DOMContentLoadedjquery.js:1055
jQuery.jQuery.extend._Deferred.deferred.resolveWithjquery.js:869
jQuery.jQuery.extend.readyjquery.js:420
jQuery.DOMContentLoadedjquery.js:1055
Conflicteren deze scripts met elkaar, of doe ik iets anders fout.
Alvast bedankt,
Usso
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
$(document).ready(function() {
var checkUser = function (username) {
//remove all the class add the messagebox classes and start fading
$("#msgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var username = $('#naam').val();
$.post(
"validate.php",
{check: 'username', user: username},
function(data) {
if(data=='no') { //if username not avaiable
$("#msgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Gebruikersnaam bestaat al!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#msgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Gebruikersnaam is beschikbaar!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
var checkSite = function (username) {
//remove all the class add the messagebox classes and start fading
$("#smsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var snaam = $('#snaam').val();
$.post(
"validate.php",
{check: 'snaam', site: username},
function(data) {
if(data=='no') { //if username not avaiable
$("#smsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Sitenaam bestaat al!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#smsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Sitenaam is beschikbaar!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
var checkPass = function (password) {
$("#pmsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var password = $('#pass').val();
var cpassword = $('#passc').val();
if((password != cpassword) || (password == "")) {
$("#pmsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Wachtwoorden kloppen niet!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#pmsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Wachtwoord OK!').addClass('messageboxok').fadeTo(900,1);
});
}
}
var checkEmail = function (email) {
$("#emsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var email = $("#email").val();
$.post(
"validate.php",
{check: 'email', emailAddress: email},
function(data) {
if(data=='no') { //if username not avaiable
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Dit email-adres is al gekoppeld aan een gebruiker!').addClass('messageboxerror').fadeTo(900,1);
});
}
else if(data=='invalid') { //if username not avaiable
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Dit email-adres is niet geldig!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Email-adres OK!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
$("#naam").blur(checkUser);
$("#snaam").blur(checkSite);
$("#passc").blur(checkPass);
$("#email").blur(checkEmail);
});
function schakel(bla) {
if(bla == "1") {
var blas = "result";
var blad = "form";
}else {
var blas = "form";
var blad = "result";
}
var show = document.getElementById(blas);
var hide = document.getElementById(blad);
hide.style.display = 'none';
show.style.display = 'block';
}
var checkUser = function (username) {
//remove all the class add the messagebox classes and start fading
$("#msgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var username = $('#naam').val();
$.post(
"validate.php",
{check: 'username', user: username},
function(data) {
if(data=='no') { //if username not avaiable
$("#msgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Gebruikersnaam bestaat al!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#msgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Gebruikersnaam is beschikbaar!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
var checkSite = function (username) {
//remove all the class add the messagebox classes and start fading
$("#smsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var snaam = $('#snaam').val();
$.post(
"validate.php",
{check: 'snaam', site: username},
function(data) {
if(data=='no') { //if username not avaiable
$("#smsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Sitenaam bestaat al!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#smsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Sitenaam is beschikbaar!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
var checkPass = function (password) {
$("#pmsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var password = $('#pass').val();
var cpassword = $('#passc').val();
if((password != cpassword) || (password == "")) {
$("#pmsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Wachtwoorden kloppen niet!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#pmsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Wachtwoord OK!').addClass('messageboxok').fadeTo(900,1);
});
}
}
var checkEmail = function (email) {
$("#emsgbox").removeClass().addClass('messagebox').text('Moment...').fadeIn("slow");
var email = $("#email").val();
$.post(
"validate.php",
{check: 'email', emailAddress: email},
function(data) {
if(data=='no') { //if username not avaiable
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Dit email-adres is al gekoppeld aan een gebruiker!').addClass('messageboxerror').fadeTo(900,1);
});
}
else if(data=='invalid') { //if username not avaiable
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Dit email-adres is niet geldig!').addClass('messageboxerror').fadeTo(900,1);
});
}
else {
$("#emsgbox").fadeTo(200,0.1,function() { //start fading the messagebox
//add message and change the class of the box and start fading
$(this).html('Email-adres OK!').addClass('messageboxok').fadeTo(900,1);
});
}
}
)
}
$("#naam").blur(checkUser);
$("#snaam").blur(checkSite);
$("#passc").blur(checkPass);
$("#email").blur(checkEmail);
});
function schakel(bla) {
if(bla == "1") {
var blas = "result";
var blad = "form";
}else {
var blas = "form";
var blad = "result";
}
var show = document.getElementById(blas);
var hide = document.getElementById(blad);
hide.style.display = 'none';
show.style.display = 'block';
}
ps: het gaat om regel 96...
ps2: Firebug geeft:
NB: Simple Validation heeft gewerkt!
Gewijzigd op 25/02/2011 22:56:11 door Usso Apury
Ja, 't moet zijn dat $("#naam") (en dus <input id="naam">) niet bestaat
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<form method="post">
<table width="930px">
<tr><td width="150px">Naam:</td><td width="150px"><input type="tekst" name="naam" id="naam" value="<?=$naam; ?>"></td><td><span id="msgbox" style="display:none"></span></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="pass" id="pass"></td><td><i>Zorg voor een <u>sterk</u> wachtwoord!</i></td></tr>
<tr><td>Herhaal WW:</td><td><input type="password" name="passc" id="passc"></td><td><span id="pmsgbox" style="display:none"></span></td></tr>
<tr><td>Geslacht:</td><td><select name="geslacht"><option value="m">Man</option><option value="v">Vrouw</option></select></td><td></td></tr>
<tr><td>Email-adres:</td><td><input type="tekst" name="email" id="email" value="<?=$email; ?>"></td><td><span id="emsgbox" style="display:none"></span></td></tr>
<tr><td>Site-naam:</td><td><input type="tekst" name="snaam" id="snaam" value="<?=$sitenaam; ?>"></td><td><span id="smsgbox" style="display:none"></span></td></tr>
<tr><td colspan="3">Ik ga akkoord met de <a href="voorwaarden.html" onclick="Modalbox.show(this.href, {title: 'Voorwaarden CJtoHost.co.cc', width: 680}); return false;">voorwaarden</a>... <input type="checkbox" onclick="this.disabled=true; document.getElementById('s').disabled=false;"></tr>
<tr><td></td><td><input type="submit" name="registreren" id="s" value="Account aanmaken" disabled></td><td></td></tr>
</table>
</form>
<table width="930px">
<tr><td width="150px">Naam:</td><td width="150px"><input type="tekst" name="naam" id="naam" value="<?=$naam; ?>"></td><td><span id="msgbox" style="display:none"></span></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="pass" id="pass"></td><td><i>Zorg voor een <u>sterk</u> wachtwoord!</i></td></tr>
<tr><td>Herhaal WW:</td><td><input type="password" name="passc" id="passc"></td><td><span id="pmsgbox" style="display:none"></span></td></tr>
<tr><td>Geslacht:</td><td><select name="geslacht"><option value="m">Man</option><option value="v">Vrouw</option></select></td><td></td></tr>
<tr><td>Email-adres:</td><td><input type="tekst" name="email" id="email" value="<?=$email; ?>"></td><td><span id="emsgbox" style="display:none"></span></td></tr>
<tr><td>Site-naam:</td><td><input type="tekst" name="snaam" id="snaam" value="<?=$sitenaam; ?>"></td><td><span id="smsgbox" style="display:none"></span></td></tr>
<tr><td colspan="3">Ik ga akkoord met de <a href="voorwaarden.html" onclick="Modalbox.show(this.href, {title: 'Voorwaarden CJtoHost.co.cc', width: 680}); return false;">voorwaarden</a>... <input type="checkbox" onclick="this.disabled=true; document.getElementById('s').disabled=false;"></tr>
<tr><td></td><td><input type="submit" name="registreren" id="s" value="Account aanmaken" disabled></td><td></td></tr>
</table>
</form>
Zie boven, die bestaat...
Toevoeging op 25/02/2011 22:55:25:
Fixed!
Ik heb het volgende regeltje boven mijn .js bestand gezet:
Dus toch 2 conflicterende libraries.
Toch bedankt!
Gewijzigd op 25/02/2011 22:55:48 door Usso Apury