Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
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
david Chavalarias
clinicaltrials
Commits
548f653a
Commit
548f653a
authored
Nov 14, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buttons to debug ajax doors DB write + working doors registration
parent
34052dce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
16 deletions
+44
-16
base_form.html
base_form.html
+20
-9
comex_reg_form_controllers.js
static/js/comex_reg_form_controllers.js
+24
-7
No files found.
base_form.html
View file @
548f653a
...
...
@@ -69,10 +69,22 @@
</div>
<!-- ########################### ( debg ) ########################## -->
<!-- test cgi user from submit point of view -->
<form
id=
"test_user_form"
enctype=
"multipart/form-data"
method=
"post"
action=
"cgi-bin/test_cgi_user.py.cgi"
>
<input
type=
"submit"
class=
"btn btn-lg btn-success"
style=
"float:right"
id=
"testsubmit"
value=
"Test user submit"
/>
</form>
<!-- ########################### ( FORM ) ########################## -->
<form
id=
"comex_reg_form"
enctype=
"multipart/form-data"
method=
"post"
onsubmit=
"whileSubmit(this)"
onsubmit=
"whileSubmit(this
, 'from form'
)"
action=
"cgi-bin/comex_merci_pour_les_infos.py.cgi"
>
<!-- todo onsubmit also save to cache -->
...
...
@@ -129,14 +141,6 @@
<input
id=
"country"
name=
"country"
type=
"text"
class=
"form-control"
placeholder=
"pays"
class=
"autocomp"
>
</div>
<p>
<button
onclick=
'whileSubmit(this.parent.parent)'
>
test doors
</button>
</p>
<!-- EMAIL & PASSWORD -->
<h3
class=
"formcat"
>
Login infos
</h3>
...
...
@@ -222,6 +226,13 @@
</form>
<p>
<button
onclick=
'whileSubmit(this, "from button")'
>
test doors
</button>
</p>
</div>
<div
class=
"spacer col-sm-2 col-md-2"
>
</div>
</div>
...
...
static/js/comex_reg_form_controllers.js
View file @
548f653a
...
...
@@ -2,19 +2,34 @@
// => block the submit button to avoid resubmit before response
// => transmit to doors
var
submitButton
=
document
.
getElementById
(
'formsubmit'
)
function
whileSubmit
(
form
)
{
console
.
log
(
form
)
submitButton
.
disabled
=
true
function
whileSubmit
(
form
,
orignStr
,
loginOrRegister
)
{
console
.
warn
(
"=====> CORS <====="
)
console
.
warn
(
"origin:"
,
orignStr
)
// submitButton.disabled = true
var
action
=
'register'
if
(
loginOrRegister
&&
loginOrRegister
==
'login'
)
{
action
=
'user'
}
console
.
log
(
"form"
,
form
)
//
submit
to doors and wait for response
//
£TEST normal case: login
to doors and wait for response
$
.
ajax
({
contentType
:
"application/json"
,
url
:
"http://localhost:8989/api/user"
,
data
:
{},
dataType
:
'json'
,
url
:
"http://localhost:8989/api/"
+
action
,
data
:
JSON
.
stringify
({
// TODO pass the real values
"login"
:
"jpp@om.fr"
,
"password"
:
"droitaubut"
,
"name"
:
"JPP"
}),
type
:
'POST'
,
success
:
function
(
data
)
{
console
.
log
(
"ajax success"
)
// console.log(data)
console
.
log
(
"response data"
,
data
)
console
.
log
(
"response data.id"
,
data
.
id
)
setTimeout
(
function
()
{
location
.
reload
();
...
...
@@ -24,6 +39,8 @@ function whileSubmit(form) {
console
.
log
(
"ajax error"
);
}
});
console
.
warn
(
"=====> end of whileSubmit <====="
)
}
...
...
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