Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A validation improved (solid red lines around the text fields in all … #1133

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions resource/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ li, td > a {
font-size: 14px;
}

label {
font-weight: normal;
}

h1, .prefLabel, .prefLabelLang, .notation {
font-family: 'Fira Sans', sans-serif;
font-size: 24px;
Expand Down Expand Up @@ -777,10 +773,14 @@ span.xl-pref-label > img {

/* feedback page
***************************/
#feedback-fields > .missing-value {
#feedback-fields > p .missing-value {
border: 1px solid red;
miguelvaara marked this conversation as resolved.
Show resolved Hide resolved
}

#feedback-fields label {
font-weight: normal;
}

#message {
height: 150px;
}
Expand Down
12 changes: 6 additions & 6 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,19 +833,19 @@ $(function() { // DOCUMENT READY

// Some form validation for the feedback form
$("#send-feedback").click(function() {
$('#email').removeClass('missing-value');
$('#message').removeClass('missing-value');
$('#msgsubject').removeClass('missing-value');
var emailMessageVal = $("#message").val();
var emailAddress = $("#email").val();
var emailSubject = $("#msgsubject").val();
var requiredFields = true;
if (emailAddress !== '' && emailAddress.indexOf('@') === -1) {
$("#email").addClass('missing-value');
requiredFields = false;
}
if (emailMessageVal === '') {
$("#message").addClass('missing-value');
requiredFields = false;
}
if (emailSubject === '') {
$("#msgsubject").addClass('missing-value');
requiredFields = false;
}
return requiredFields;
});

Expand Down
8 changes: 5 additions & 3 deletions view/feedback.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
</p>
<p>
<label for="msgsubject">{% trans %}Subject:{% endtrans %}</label>
<input id="msgsubject" class="form-control" type="text" size="40" name="msgsubject" placeholder="{% trans %}Write a subject{% endtrans %}">
<input id="msgsubject" class="form-control" type="text" size="40" name="msgsubject" placeholder="{% trans %}Write a subject{% endtrans %}" >
</p>
<p>
<label for="message">{% trans %}Message:{% endtrans %}</label>
<textarea id="message" class="form-control" name="message"></textarea>
</p>
<label for="message">{% trans %}Message:{% endtrans %}</label>
<textarea id="message" class="form-control" name="message"></textarea>
{{ honeypot.generate('item-description', 'user-captcha')|raw }}
<button type="submit" class="btn btn-primary" id="send-feedback">{% trans %}Send feedback{% endtrans %}</button>
</form>
Expand Down