From 967df9dbd428564fde2b074059c8d5771617c990 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 29 Oct 2015 13:28:50 -0400 Subject: [PATCH 1/2] #395 Fix custom field requirements --- index.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index bd74d58f..535f16a4 100644 --- a/index.php +++ b/index.php @@ -403,7 +403,6 @@ function print_add_ticket() $formattedId = preg_replace("/[\s_]/", "-", $formattedId); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; - echo '
+ value="' . $v['value'] . '" '.$errorText. ' '.$required.' readonly> ' . $hesklang['date_format'] . '
'; @@ -706,6 +706,7 @@ function print_add_ticket() $v['name'] = $hesklang[$v['name']]; } + $required = $v['req'] ? 'required' : ''; $v['req'] = $v['req'] ? '*' : ''; if ($v['type'] == 'checkbox' || $v['type'] == 'multiselect') { @@ -857,10 +858,13 @@ function print_add_ticket()
-
'; + + + '; break; case 'date': + $errorText = $required == 'required' ? 'data-error="'.htmlspecialchars($hesklang['this_field_is_required']).'"' : ''; //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\s_]/", "-", $formattedId); @@ -876,8 +880,9 @@ function print_add_ticket()
+ value="' . $v['value'] . '" '.$errorText. ' readonly="readonly" '.$required.'> ' . $hesklang['date_format'] . ' +
'; break; From b58bc19286dee61d2eee4e29e6b32bb63f17376c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 29 Oct 2015 13:35:05 -0400 Subject: [PATCH 2/2] Validate anti-spam question --- index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 535f16a4..15af7ffd 100644 --- a/index.php +++ b/index.php @@ -1009,7 +1009,12 @@ function print_add_ticket() $value = stripslashes(hesk_input($_SESSION['c_question'])); } $cls = in_array('question', $_SESSION['iserror']) ? ' class="isError" ' : ''; - echo '
' . $hesk_settings['question_ask'] . '
'; + echo '
' . $hesk_settings['question_ask'] . '
+ +
+
'; ?>