1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 07:36:32 +02:00

#5123 - FAQ make AaQ field required and add min char limit

Needs additional fix in form_handler to support minlength attribute for textarea
This commit is contained in:
Moc
2023-11-30 21:41:32 +01:00
parent 05727b8b52
commit 3ad27cd8c2
4 changed files with 11 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ class faqs_shortcodes extends e_shortcode
private $share = false;
private $datestamp = false;
private $questionCharLimit = 255;
private $questionCharMin = 20;
public $pref;
public $tag;
public $category;
@@ -55,6 +56,11 @@ class faqs_shortcodes extends e_shortcode
$this->questionCharLimit = intval($pref['submit_question_char_limit']);
}
if(!empty($pref['submit_question_char_min']))
{
$this->questionCharMin = intval($pref['submit_question_char_min']);
}
}
// Simply FAQ count when needed.
@@ -331,7 +337,7 @@ class faqs_shortcodes extends e_shortcode
{
$text .= $frm->open('faq-ask-question','post');
//TODO LAN ie. [x] character limit.
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength' =>$this->questionCharLimit, 'size' =>'xxlarge', 'placeholder' =>LAN_FAQS_012, 'wrap' =>'soft'))."
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('required' => true, 'maxlength' => $this->questionCharLimit, 'minlength' => $this->questionCharMinLimit, 'size' =>'xxlarge', 'placeholder' =>LAN_FAQS_012, 'wrap' =>'soft'))."
<div class='faq-char-limit'><small>".$this->questionCharLimit." ".LAN_FAQS_013."</small></div>".$frm->submit('submit_a_question',LAN_SUBMIT)."</div>";
$text .= $frm->close();