Subject: The mailing list for listmasters using Sympa
List archive
- From: IKEDA Soji <address@concealed>
- To: "Silvers, Tim" <address@concealed>
- Cc: "address@concealed" <address@concealed>
- Subject: Re: [en@sympa] Evaluating input in form fields
- Date: Fri, 18 Nov 2022 10:42:30 +0900
Hi,
On 2022/11/16 3:53, Silvers, Tim wrote:
Hi. Has anyone customized Sympa to perform any form field input validations? In our case, we would like to ensure that any created lists include a “-L” (i.e., dash el) in their names. The code is in create_list_request.tt2 and I have been reviewing the template directives [1] in an attempt to find a solution. Perhaps a FILTER would work? Or a PERL block?
Here is the code from create_list_request.tt2:
<input type="text" id="listname" name="listname" size="30" value="[% saved.listname %]" />
<!-- CODE CHECK FOR DASH EL IN LIST NAME -->
[% IF saved.listname !~ '<chars>-L$' %]
[% SET saved.listname = ${saved-listname} _ '-l' %]
[% END %]
[1] http://www.template-toolkit.org/docs/manual/Directives.html#section_Conditional_Processing <http://www.template-toolkit.org/docs/manual/Directives.html#section_Conditional_Processing>
Tim
As the template is rendered before the form is shown, it cannot validate
form input.
If you can assume that the users' browsers are HTML5 compliant (a
reasonable assumption these days), then the input element may be given a
"pattern" attribute.
<input type="text" id="listname" name="listname" size="30" value="[% saved.listname %]" pattern="[0-9A-Za-z][-+._0-9A-Za-z]*-[Ll]" />
For more details about client-side form validation, see this article
in MDN:
https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
Regards,
-- Soji
--
株式会社 コンバージョン
ITソリューション部 システムソリューション1グループ 池田荘児
e-mail address@concealed
https://www.conversion.co.jp/
-
[en@sympa] Evaluating input in form fields,
Silvers, Tim, 11/15/2022
-
Re: [en@sympa] Evaluating input in form fields,
Silvers, Tim, 11/16/2022
-
Re: [en@sympa] Evaluating input in form fields,
David Verdin, 11/17/2022
- Re: [en@sympa] Evaluating input in form fields, Silvers, Tim, 11/17/2022
- Re: [en@sympa] Evaluating input in form fields, Alban Rodriguez, 11/17/2022
-
Re: [en@sympa] Evaluating input in form fields,
David Verdin, 11/17/2022
-
Re: [en@sympa] Evaluating input in form fields,
IKEDA Soji, 11/18/2022
- Re: [en@sympa] [External] Re: Evaluating input in form fields, Silvers, Tim, 11/18/2022
-
Re: [en@sympa] Evaluating input in form fields,
Silvers, Tim, 11/16/2022
Archive powered by MHonArc 2.6.19+.