Skip to content

Commit

Permalink
Merge pull request #42 from ktsrivastava29/main
Browse files Browse the repository at this point in the history
a few fixes
  • Loading branch information
lucifer1708 authored Sep 1, 2023
2 parents e87540e + 949cfea commit a310f2f
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 9 deletions.
Empty file added static/css/form.css
Empty file.
97 changes: 96 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@
border: 0px solid #f1f2f3;
border-top: 1px solid #00FFCA;
padding: 20px;
font-style: italic;
}

@media (min-width: 780px) {
Expand Down Expand Up @@ -1066,7 +1067,7 @@ <h4 class="modal-title" id="myModalLabel">{{terms.title|safe}}</h4>
});
</script>

<script>
{% comment %} <script>
// JS for form
$(document).ready(function(){

Expand Down Expand Up @@ -1139,6 +1140,100 @@ <h4 class="modal-title" id="myModalLabel">{{terms.title|safe}}</h4>

});
</script>
{% endcomment %}

<script>
// JS for form
$(document).ready(function(){

var current_fs, next_fs, previous_fs;

// No BACK button on first screen
if($(".show").hasClass("first-screen")) {
$(".prev").css({ 'display' : 'none' });
}

// Next button
$(".next-button").click(function(){

current_fs = $(this).parent().parent();
next_fs = $(this).parent().parent().next();

// Validate the current card's input fields
if (validateFields(current_fs)) {
$(".prev").css({ 'display' : 'block' });

$(current_fs).removeClass("show");
$(next_fs).addClass("show");

$("#progressbar li").eq($(".card2").index(next_fs)).addClass("active");

current_fs.animate({}, {
step: function() {
current_fs.css({
'display': 'none',
'position': 'relative'
});

next_fs.css({
'display': 'block'
});
}
});
}
});

// Previous button
$(".prev").click(function(){

current_fs = $(".show");
previous_fs = $(".show").prev();

$(current_fs).removeClass("show");
$(previous_fs).addClass("show");

$(".prev").css({ 'display' : 'block' });

if($(".show").hasClass("first-screen")) {
$(".prev").css({ 'display' : 'none' });
}

$("#progressbar li").eq($(".card2").index(current_fs)).removeClass("active");

current_fs.animate({}, {
step: function() {
current_fs.css({
'display': 'none',
'position': 'relative'
});

previous_fs.css({
'display': 'block'
});
}
});
});

// Function to validate the fields in a card
function validateFields(card) {
// You can add validation logic here for each input field
var isValid = true;

// Example validation for name input (you can extend this for other fields)
var nameInput = card.find("input[name='name']");
if (nameInput.val().trim() === '') {
isValid = false;
nameInput.next(".help-block").text("Name is required.");
} else {
nameInput.next(".help-block").text(""); // Clear error message
}

// Add similar validation logic for other fields

return isValid;
}
});
</script>

</body>

Expand Down
16 changes: 8 additions & 8 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ <h6 class="mb-5">CV Upload</h6>
<div class="row px-3 inputBox">
<div class="form-group mt-1 mb-1">
{{form.name}}
<label class="ml-3 form-control-placeholder" for="email">{{i.name_input|safe}}</label>
<label class="form-control-placeholder" for="email">{{i.name_input|safe}}</label>
{% if form.name.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.name.errors }}</div>
{% endif %}
</div>
<div class="form-group mt-1 mb-1"> {{form.email}} <label class="ml-3 form-control-placeholder" for="email">{{i.email_input|safe}}</label>
<div class="form-group mt-1 mb-1"> {{form.email}} <label class=" form-control-placeholder" for="email">{{i.email_input|safe}}</label>
{% if form.email.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.email.errors }}</div>
{% endif %}
</div>
<div class="form-group mt-1 mb-1"> {{form.phone_number}} <label class="ml-3 form-control-placeholder" for="email">{{i.phone_number_input|safe}}</label>
<div class="form-group mt-1 mb-1"> {{form.phone_number}} <label class=" form-control-placeholder" for="email">{{i.phone_number_input|safe}}</label>
{% if form.phone_number.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.phone_number.errors }}</div>
{% endif %}
Expand All @@ -75,29 +75,29 @@ <h6 class="mb-5">CV Upload</h6>
<div class="row px-3 inputBox">
<div class="form-group mt-1 mb-1">
{{form.skills}}
<label class="ml-3 form-control-placeholder" for="pwd">Your Skills</label>
<label class=" form-control-placeholder" for="pwd">Your Skills</label>
{% if form.skills.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.skills.errors }}</div>
{% endif %}
</div>
<div class="row px-3 mt-3 inputBox">
<div class="form-group mt-1 mb-1">
{{form.strength}}
<label class="ml-3 form-control-placeholder" for="pwd">Your Strengths</label>
<label class=" form-control-placeholder" for="pwd">Your Strengths</label>
{% if form.strength.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.strength.errors }}</div>
{% endif %}
</div>
<div class="form-group mt-1 mb-1">
{{form.weakness}}
<label class="ml-3 form-control-placeholder" for="pwd">Your Weaknesses</label>
<label class=" form-control-placeholder" for="pwd">Your Weaknesses</label>
{% if form.weakness.errors %}
<div class="help-block" style="margin-top:-27px; color: #ffe300;">{{ form.weakness.errors }}</div>
{% endif %}
</div>
</div>
<div class="prev text-center mt-1"><span class="fa fa-arrow-left"> </span> back</span> </div>
<div class="next-button text-center mt-1">Next <span class="fa fa-arrow-right"></span> </div>
<div class="prev text-center mt-1"><span class="fa fa-arrow-left fa-lg"> </span> </span> </div>
<div class="next-button text-center mt-1"><span class="fa fa-arrow-right fa-lg"></span> </div>

</div>
</div>
Expand Down

0 comments on commit a310f2f

Please sign in to comment.