Skip to content

Commit

Permalink
form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammedHamioui committed May 26, 2022
1 parent a640281 commit 9111a7d
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .idea/Zappster_app.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added database.db
Binary file not shown.
Binary file modified static/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,31 @@ li:hover {
.Subtitle {
font-family: new-order, sans-serif;
text-align: center;
margin-top: 2vh;
}

.border-circle{
border-radius: 50%;
max-width: 100%;
border: 3px solid #000;
min-width: 100%;
}
}

figcaption {
font-family: new-order, sans-serif;
}

.modal-content {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
pointer-events: auto;
background-color: #ffffff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.2);
border-radius: 0.3rem;
outline: 0;
padding: 1vh;
font-family: new-order, sans-serif;
}
4 changes: 2 additions & 2 deletions templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 class="HeadTitle">Over ons</h1>
<figure>
<img class="rounded-circle mt-3 img-fluid" src="/static/Mo.png" alt="Mohammed" width="200" height="200" />
<figcaption class="pt-3">
<span class="fw-bold">Mohammed Hamioui</span><br />Ik ben Mohammed, 19 jaar en heb passie voor technologie en cyber security. Verantwoordelijk voor de business kaart layout en het front-end gedeelte van de website<br />
<span class="fw-bold">Mohammed Hamioui</span><br />Ik ben Mohammed, 19 jaar en heb passie voor technologie en cyber security. Verantwoordelijk voor de business kaart layout en het front-end gedeelte van de website.<br />
</figcaption>
</figure>
</div>
Expand All @@ -37,7 +37,7 @@ <h1 class="HeadTitle">Over ons</h1>
<img class="rounded-circle mt-3 img-fluid" src="/static/kais.png" alt="kaïs" width="200" height="200" />
<figcaption class="pt-3 pb-2">
<span class="fw-bold">kaïs Boutaleb</span><br />
Ik ben kaïs, 21 jaar en fan van alles waar technologie in zit. Ik ben zeer geïnteresseerd in cybersecurity en AI. maar ook andere zaken buiten IT zoals talen en muziek. Hier ben ik verantwoordelijk voor de backend van de website
Ik ben kaïs, 21 jaar en fan van alles waar technologie in zit. Ik ben zeer geïnteresseerd in cybersecurity en AI. maar ook andere zaken buiten IT zoals talen en muziek. Hier ben ik verantwoordelijk voor de backend van de website.
</figcaption>
</figure>
</div>
Expand Down
13 changes: 11 additions & 2 deletions templates/get_wish.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@
{% block content %}
<h1 class="HeadTitle">Vul de code in en lees het bericht</h1>
<div class="container">
<form action="/show_wish" method="post">
<form action="/show_wish" method="post" name="uniquecode" onsubmit="return validateForm()">
<div class="form-group">
<label for="sender">Unique code:</label>
<label for="sender">Unieke code:</label>
<input type="text" class="form-control" id="uuid" name="uuid" style="border-radius: 2vh;">
</div>
<button type="submit" class="btn btn-primary" style="margin: 2vh 2vh 30vh 0vh;">Submit</button>
</form>
<script>
function validateForm() {
var code = document.forms["uniquecode"]["uuid"].value;
if (code == "") {
alert("Vul a.u.b. de unieke code in.");
return false;
}
}
</script>
</div>
{% endblock %}
90 changes: 60 additions & 30 deletions templates/send_wish.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,71 +12,101 @@ <h1 class="HeadTitle">Stuur uw boodschap</h1>
<img class="img-fluid" src="/static/{{ card['cardid'] }}.jpg"
style="width:267px;height:386px;display:block;margin:auto;"/>
</div>
<form class="col-xs-12 col-sm-8" action="/wish_insert" method="post" id="wish_form" name="wish_form">
<form class="col-xs-12 col-sm-8" action="/wish_insert" method="post" id="wish_form" name="wish_form" onsubmit="return validateForm()">
<input type="hidden" id="card_id" name="card_id" value="{{ card['cardid'] }}"
style="border-radius: 2vh;">
<div class="form-group">
<label for="sender">From:</label>
<label for="sender">Zender:</label>
<input type="text" class="form-control" id="sender" name="sender" style="border-radius: 2vh;">
</div>
<div class="form-group">
<label for="receiver">To:</label>
<label for="receiver">Ontvanger:</label>
<input type="text" class="form-control" id="receiver" name="receiver" style="border-radius: 2vh;">
</div>
<div class="form-group">
<label for="message">Message:</label>
<label for="message">Boodschap:</label>
<textarea class="form-control" rows="5" id="message" name="message"
style="border-radius: 2vh;"></textarea>
</div>
<input type="hidden" class="form-control" id="send_method" name="send_method">
<input type="hidden" class="form-control" id="send_destination" name="send_destination">

<hr>
<input type="button" name="btn" value="Submit" id="submitBtn" data-bs-toggle="modal" data-bs-target="#confirm-submit"
<input type="button" name="btn" value="Submit" id="submitBtn" data-bs-toggle="modal" data-bs-target="#confirm-submit"
class="btn btn-default bg-primary"/>
</form>
</div>
<div class="modal fade" id="confirm-submit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">Confirm Submit</div>
<div class="modal-body">How do you want to send the card?
<div class="modal-header">Verzending bevestigen</div>
<div class="modal-body">Hoe wenst u de kaart te versturen?
<table class="table">
<tr>
<th>Sender:</th>
<th>Zender:</th>
<td id="sender"></td>
</tr>
<tr>
<th>Receiver:</th>
<th>Ontvanger:</th>
<td id="receiver"></td>
</tr>
<tr>
<th>Message:</th>
<th>Boodschap:</th>
<td id="message"></td>
</tr>
</table>
</div>
<div class="form-group" id="send_method">
<label for="email">Email:</label>
<input type="radio" onclick="checkSendMethod();" name="send_method" id="email_radio"
value="email"/>
<label for="post">Post:</label>
<input type="radio" onclick="checkSendMethod();" name="send_method" id="post_radio"
value="post"/>
</div>
<div class="form-group" id="email_field" style="display:none">
<label for="message">E-mail:</label>
<input type="text" class="form-control" rows="5" id="email_input" name="email">
</div>
<div class="form-group" id="post_field" style="display:none">
<label for="message">Address:</label>
<input type="text" class="form-control" rows="5" id="post_input" name="post">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
<button id="submit" form="wish_form" class="btn btn-success success">Submit</button>
</div>
<form name="card_send" onsubmit="return validateForm()">
<div class="form-group" id="send_method">
<label for="email">Email:</label>
<input type="radio" onclick="checkSendMethod();" name="send_method" id="email_radio"
value="email"/>
<label for="post">Post:</label>
<input type="radio" onclick="checkSendMethod();" name="send_method" id="post_radio"
value="post"/>
</div>
<div class="form-group" id="email_field" style="display:none">
<label for="message">E-mail:</label>
<input type="text" class="form-control" rows="5" id="email_input" name="email" >
</div>
<div class="form-group" id="post_field" style="display:none">
<label for="message">Address:</label>
<input type="text" class="form-control" rows="5" id="post_input" name="post" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
<button id="submit" form="wish_form" class="btn btn-success success">Submit</button>
</div>

</form>
<script>
function validateForm() {
var sender = document.forms["wish_form"]["sender"].value;
var receiver = document.forms["wish_form"]["receiver"].value;
var message = document.forms["wish_form"]["message"].value;
var email = document.getElementById("email_input").value
var post = document.getElementById("post_input").value

if (sender == "") {
alert("Vul a.u.b. de zender in.");
return false;
}
if (receiver == "") {
alert("Vul a.u.b. de ontvanger in.");
return false;
}
if (message == "") {
alert("Vul a.u.b. de boodschap in.");
return false;
}

if (email == "" && post == "") {
alert("gelieve het adres of email adres in te voeren.")
return false;
}
}
</script>
</div>
</div>
</div>
Expand Down

0 comments on commit 9111a7d

Please sign in to comment.