Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oscar Enrique Gonzalez Escurra
th-app-java
Commits
2f4802c5
Commit
2f4802c5
authored
Nov 17, 2021
by
Cesar Giulano Gonzalez Maqueda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validacion de form (minimo un cargo, tecno)
parent
3161d692
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
56 deletions
+76
-56
curriculumsearch/src/main/resources/static/main.js
+76
-56
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
+0
-0
No files found.
curriculumsearch/src/main/resources/static/main.js
View file @
2f4802c5
...
@@ -192,7 +192,6 @@ function serializeJSON (form) {
...
@@ -192,7 +192,6 @@ function serializeJSON (form) {
// Create a new FormData object
// Create a new FormData object
const
formData
=
new
FormData
(
form
);
const
formData
=
new
FormData
(
form
);
// Create an object to hold the name/value pairs
// Create an object to hold the name/value pairs
const
pairs
=
{};
const
pairs
=
{};
...
@@ -205,7 +204,23 @@ function serializeJSON (form) {
...
@@ -205,7 +204,23 @@ function serializeJSON (form) {
pairs
[
"tecnologias"
]
=
tecnologias
.
filter
(
tec
=>
tec
)
//eliminacion de nulos
pairs
[
"tecnologias"
]
=
tecnologias
.
filter
(
tec
=>
tec
)
//eliminacion de nulos
pairs
[
"postulaciones"
]
=
postulaciones
.
filter
(
car
=>
car
)
//eliminacion de nulos
pairs
[
"postulaciones"
]
=
postulaciones
.
filter
(
car
=>
car
)
//eliminacion de nulos
pairs
[
"referencias"
]
=
referencias
.
filter
(
tec
=>
tec
)
pairs
[
"referencias"
]
=
referencias
.
filter
(
tec
=>
tec
)
if
(
pairs
[
"postulaciones"
].
length
<
1
){
document
.
querySelector
(
"#no-valid-cargo"
).
style
.
display
=
"block"
;
noValidateFlag
=
true
;
}
else
{
document
.
querySelector
(
"#no-valid-cargo"
).
style
.
display
=
"none"
;
}
console
.
log
(
pairs
[
"tecnologias"
])
if
(
pairs
[
"tecnologias"
].
length
<
1
){
document
.
querySelector
(
"#no-valid-tecno"
).
style
.
display
=
"block"
;
noValidateFlag
=
true
;
}
else
{
document
.
querySelector
(
"#no-valid-tecno"
).
style
.
display
=
"none"
;
}
if
(
noValidateFlag
){
return
;
}
noValidateFlag
=
false
// Return the JSON string
// Return the JSON string
return
JSON
.
stringify
(
pairs
,
null
,
2
);
return
JSON
.
stringify
(
pairs
,
null
,
2
);
...
@@ -229,7 +244,11 @@ async function postData(url = '', data = {}) {
...
@@ -229,7 +244,11 @@ async function postData(url = '', data = {}) {
body
:
data
// body data type must match "Content-Type" header
body
:
data
// body data type must match "Content-Type" header
}
}
senddata
[
"headers"
][
headerxs
]
=
token
;
senddata
[
"headers"
][
headerxs
]
=
token
;
const
response
=
await
fetch
(
url
,
senddata
);
let
response
=
null
console
.
log
(
noValidateFlag
)
if
(
!
noValidateFlag
){
response
=
await
fetch
(
url
,
senddata
);
}
return
response
;
// parses JSON response into native JavaScript objects
return
response
;
// parses JSON response into native JavaScript objects
}
}
formValidator
()
formValidator
()
...
@@ -529,57 +548,57 @@ function eliminarReferencia(event) {
...
@@ -529,57 +548,57 @@ function eliminarReferencia(event) {
/*--------------------------------------------------------------------------------------------------------- */
/*--------------------------------------------------------------------------------------------------------- */
$
(
function
(){
//
$(function(){
$
(
"#wizard"
).
steps
({
//
$("#wizard").steps({
headerTag
:
"h4"
,
//
headerTag: "h4",
bodyTag
:
"section"
,
//
bodyTag: "section",
transitionEffect
:
"fade"
,
//
transitionEffect: "fade",
enableAllSteps
:
true
,
//
enableAllSteps: true,
transitionEffectSpeed
:
500
,
//
transitionEffectSpeed: 500,
onStepChanging
:
function
(
event
,
currentIndex
,
newIndex
)
{
//
onStepChanging: function (event, currentIndex, newIndex) {
if
(
newIndex
===
1
)
{
//
if ( newIndex === 1 ) {
$
(
'.steps ul'
).
addClass
(
'step-2'
);
//
$('.steps ul').addClass('step-2');
}
else
{
//
} else {
$
(
'.steps ul'
).
removeClass
(
'step-2'
);
//
$('.steps ul').removeClass('step-2');
}
//
}
if
(
newIndex
===
2
)
{
//
if ( newIndex === 2 ) {
$
(
'.steps ul'
).
addClass
(
'step-3'
);
//
$('.steps ul').addClass('step-3');
}
else
{
//
} else {
$
(
'.steps ul'
).
removeClass
(
'step-3'
);
//
$('.steps ul').removeClass('step-3');
}
//
}
//
if
(
newIndex
===
3
)
{
//
if ( newIndex === 3 ) {
$
(
'.steps ul'
).
addClass
(
'step-4'
);
//
$('.steps ul').addClass('step-4');
$
(
'.actions ul'
).
addClass
(
'step-last'
);
//
$('.actions ul').addClass('step-last');
}
else
{
//
} else {
$
(
'.steps ul'
).
removeClass
(
'step-4'
);
//
$('.steps ul').removeClass('step-4');
$
(
'.actions ul'
).
removeClass
(
'step-last'
);
//
$('.actions ul').removeClass('step-last');
}
//
}
return
true
;
//
return true;
},
//
},
labels
:
{
//
labels: {
finish
:
"Order again"
,
//
finish: "Order again",
next
:
"Next"
,
//
next: "Next",
previous
:
"Previous"
//
previous: "Previous"
}
//
}
});
//
});
// Custom Steps Jquery Steps
//
// Custom Steps Jquery Steps
$
(
'.wizard > .steps li a'
).
click
(
function
(){
//
$('.wizard > .steps li a').click(function(){
$
(
this
).
parent
().
addClass
(
'checked'
);
//
$(this).parent().addClass('checked');
$
(
this
).
parent
().
prevAll
().
addClass
(
'checked'
);
//
$(this).parent().prevAll().addClass('checked');
$
(
this
).
parent
().
nextAll
().
removeClass
(
'checked'
);
//
$(this).parent().nextAll().removeClass('checked');
});
//
});
// Custom Button Jquery Steps
//
// Custom Button Jquery Steps
$
(
'.forward'
).
click
(
function
(){
//
$('.forward').click(function(){
$
(
"#wizard"
).
steps
(
'next'
);
//
$("#wizard").steps('next');
})
//
})
$
(
'.backward'
).
click
(
function
(){
//
$('.backward').click(function(){
$
(
"#wizard"
).
steps
(
'previous'
);
//
$("#wizard").steps('previous');
})
//
})
// Checkbox
//
// Checkbox
$
(
'.checkbox-circle label'
).
click
(
function
(){
//
$('.checkbox-circle label').click(function(){
$
(
'.checkbox-circle label'
).
removeClass
(
'active'
);
//
$('.checkbox-circle label').removeClass('active');
$
(
this
).
addClass
(
'active'
);
//
$(this).addClass('active');
})
//
})
})
//
})
/*--------------------------------------------------------------------------------------------------------- */
/*--------------------------------------------------------------------------------------------------------- */
\ No newline at end of file
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
View file @
2f4802c5
This diff is collapsed.
Click to expand it.
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