add further checkboxes to form and improve styling

lektura
max.mehl 2017-03-23 21:37:01 +01:00
parent 0eef39194f
commit 4cf860d077
4 changed files with 31 additions and 10 deletions

View File

@ -84,7 +84,9 @@ DefaultContentLanguage = "en"
formEmail = "Email (required)"
formCountry = "Country"
formZip = "ZIP Code"
formPermission1 = "I have read the privacy statement and would like to stay informed about the future of this campaign"
formPermissionPriv = "I have read and accepted the [privacy statement](#)"
formPermissionNews = "I want to stay informed about the future of PMPC"
formPermissionPub = "I want my signature to appear in the [list of signatures](/signatures)"
formSubmit = "Sign"
# Spread the word section

View File

@ -20,10 +20,19 @@
<label class="sign-input form-zp">
<input name="zip" placeholder="{{ .Site.Params.sign.formZip }}" type="text" />
</label>
<br />
<label class="form-pe">
<input name="permission" value="yes" type="checkbox" required /> {{ .Site.Params.sign.formPermission1 }}
</label>
<p class="form-pe">
<label class="form-pe">
<input name="permissionPriv" value="yes" type="checkbox" required /> {{ .Site.Params.sign.formPermissionPriv | markdownify }}
</label>
<br />
<label class="form-pe">
<input name="permissionNews" value="yes" type="checkbox" checked="checked" /> {{ .Site.Params.sign.formPermissionNews }}
</label>
<br />
<label class="form-pe">
<input name="permissionPub" value="yes" type="checkbox" checked="checked" /> {{ .Site.Params.sign.formPermissionPub | markdownify}}
</label>
</p>
<input id="honey" name="url" value="yes" type="submit" /> <!-- Honeypot for spam -->
<br />

View File

@ -16,10 +16,12 @@ if(empty($action)) {
$email = isset($_GET['email']) ? $_GET['email'] : false;
$country = isset($_GET['country']) ? $_GET['country'] : false;
$zip = isset($_GET['zip']) ? $_GET['zip'] : false;
$perm = isset($_GET['permission']) ? $_GET['permission'] : false;
$permPriv = isset($_GET['permissionPriv']) ? $_GET['permissionPriv'] : false;
$permNews = isset($_GET['permissionNews']) ? $_GET['permissionNews'] : false;
$permPub = isset($_GET['permissionPub']) ? $_GET['permissionPub'] : false;
// Check for missing required fields
if(empty($name) || empty($email) || empty($perm)) {
if(empty($name) || empty($email) || empty($permPriv)) {
echo "At least one required variable is empty.";
exit(1);
}
@ -73,7 +75,9 @@ if ($action === "sign") {
"email" => $email,
"country" => $country,
"zip" => $zip,
"perm" => $perm,
"permPriv" => $permPriv,
"permNews" => $permNews,
"permPub" => $permPub,
"code" => $code,
"confirmed" => "no");
$data[] = $newsig; // newsig is a separated variable for debugging purposes

View File

@ -68,8 +68,14 @@
content: "\f08d";
padding-left: 3px;
}
.form-pe {
max-width: 600px;
p.form-pe {
text-align: left;
max-width: 530px; /* to not let the checkboxed go far more left than the input boxes above */
margin: 0 auto;
}
p.form-pe a {
color: inherit;
text-decoration: underline;
}
input#honey {
display: none;