Skip to Content.
Sympa Menu

en - Re: [en@sympa] [External] Re: Evaluating input in form fields

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: "Silvers, Tim" <address@concealed>
  • To: IKEDA Soji <address@concealed>
  • Cc: "address@concealed" <address@concealed>
  • Subject: Re: [en@sympa] [External] Re: Evaluating input in form fields
  • Date: Fri, 18 Nov 2022 14:51:04 +0000

Thanks, Soji. I appreciate the information. I’ll review.

 

Tim

 

 

From: IKEDA Soji <address@concealed>
Date: Thursday, November 17, 2022 at 8:42 PM
To: Silvers, Tim <address@concealed>
Cc: address@concealed <address@concealed>
Subject: [External] Re: [en@sympa] Evaluating input in form fields

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.
-------

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]
> https://nam12.safelinks.protection.outlook.com/?url="http%3A%2F%2Fwww.template-toolkit.org%2Fdocs%2Fmanual%2FDirectives.html%23section_Conditional_Processing&amp;data=05%7C01%7Ctsilver%40iu.edu%7C82daab44711f417eba3008dac9062f20%7C1113be34aed14d00ab4bcdd02510be91%7C0%7C0%7C638043325678962972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=ezaCzQyeQMy%2BrN9xM2MGoS3p7CZt7DuEroycI%2FitxxY%3D&amp;reserved=0 <https://nam12.safelinks.protection.outlook.com/?url="http%3A%2F%2Fwww.template-toolkit.org%2Fdocs%2Fmanual%2FDirectives.html%23section_Conditional_Processing&amp;data=05%7C01%7Ctsilver%40iu.edu%7C82daab44711f417eba3008dac9062f20%7C1113be34aed14d00ab4bcdd02510be91%7C0%7C0%7C638043325678962972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=ezaCzQyeQMy%2BrN9xM2MGoS3p7CZt7DuEroycI%2FitxxY%3D&amp;reserved=0>
>
> 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://nam12.safelinks.protection.outlook.com/?url="https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FLearn%2FForms%2FForm_validation&amp;data=05%7C01%7Ctsilver%40iu.edu%7C82daab44711f417eba3008dac9062f20%7C1113be34aed14d00ab4bcdd02510be91%7C0%7C0%7C638043325678962972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=KYjOQhSEGWY2SZwFq12oePn5pUo0vEViMPQmDmALOHA%3D&amp;reserved=0

Regards,
-- Soji

--
株式会社 コンバージョン
ITソリューション部 システムソリューション1グループ 池田荘児
e-mail address@concealed
https://nam12.safelinks.protection.outlook.com/?url="https%3A%2F%2Fwww.conversion.co.jp%2F&amp;data=05%7C01%7Ctsilver%40iu.edu%7C82daab44711f417eba3008dac9062f20%7C1113be34aed14d00ab4bcdd02510be91%7C0%7C0%7C638043325678962972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=8avIwQ6v39gHBQLtgX0%2Ftcwx9lL46WOTbWpLIeZJLqI%3D&amp;reserved=0




Archive powered by MHonArc 2.6.19+.

Top of Page