Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
23a16b1a
Commit
23a16b1a
authored
Aug 23, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Field validations.
parent
92e9d87c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
lms/static/js/jQuery.validity.min.js
+0
-0
lms/templates/signup_modal.html
+33
-5
No files found.
lms/static/js/jQuery.validity.min.js
deleted
100755 → 0
View file @
92e9d87c
This diff is collapsed.
Click to expand it.
lms/templates/signup_modal.html
View file @
23a16b1a
...
...
@@ -122,13 +122,41 @@
<script
type=
"text/javascript"
>
(
function
()
{
$
(
document
).
delegate
(
'#register_form'
,
'ajax:before'
,
function
()
{
var
username
=
$
(
"input[name=username]"
).
value
();
console
.
log
(
username
)
return
false
;
$
.
fn
.
extend
({
minLength
:
function
(
length
)
{
$
(
this
).
on
(
"blur"
,
function
()
{
$
(
this
).
next
(
".validation-error-message"
).
remove
()
if
(
$
(
this
).
val
().
length
<
length
)
{
$
(
this
).
addClass
(
"validation-error"
);
$
(
this
).
after
(
"<div class='validation-error-message'>Must be at least "
+
length
+
" characters.</div>"
);
}
else
{
$
(
this
).
removeClass
(
"validation-error"
);
}
});
return
$
(
this
);
},
matchEmail
:
function
()
{
$
(
this
).
on
(
"blur"
,
function
()
{
$
(
this
).
next
(
".validation-error-message"
).
remove
()
var
re
=
/^
(([^
<>()[
\]\\
.,;:
\s
@
\"]
+
(\.[^
<>()[
\]\\
.,;:
\s
@
\"]
+
)
*
)
|
(\"
.+
\"))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
if
(
!
re
.
test
(
$
(
this
).
val
()))
{
$
(
this
).
addClass
(
"validation-error"
);
$
(
this
).
after
(
"<div class='validation-error-message'>Must be a valid email address</div>"
);
}
else
{
$
(
this
).
removeClass
(
"validation-error"
);
}
});
return
$
(
this
);
}
});
$
(
document
).
ready
(
function
(){
$
(
"input[name=username]"
).
minLength
(
2
);
$
(
"input[name=email]"
).
matchEmail
();
$
(
"input[name=password]"
).
minLength
(
2
);
$
(
"input[name=name]"
).
minLength
(
2
);
});
$
(
document
).
delegate
(
'#register_form'
,
'ajax:success'
,
function
(
data
,
json
,
xhr
)
{
if
(
json
.
success
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment