Item2524: strikeone and custom HTML forms

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Engine
Component: Documentation
Branches:
Reported By: MatthewDent
Waiting For:
Last Change By: CrawfordCurrie
Some better documentation is needed for using strikeone with HTML forms. I'm not a doc writer, but here's what I recently discovered after having difficulty -- perhaps someone can add it to the docs. At least now it's recorded somewhere.

When creating a custom HTML form and desiring that the strikeone protections automatically be added in order to avoid the confirmation screen, the form tag must include the attribute method="POST"

The important things to note in Foswiki 1.0.7:
  • the tag "form" must be in lower case,
  • the attribute "method" must be in lower case,
  • the value POST must be in upper case, and
  • the value POST must be surrounded by either single or double quotes).

[see Foswiki.pm --- where the regex line reads: $text =~ s/(<form[^>]*method=['"]POST['"][^>]*>)  - 

if you use this formula:
  <form action="%SCRIPTURLPATH{save}%/%WEB%/%BASETOPIC%" method="POST"> 
the validation key and strikeone onSubmit string will automatically be added. If you do not use method="POST" or method='POST' it will not be added.

An additional note for devs -- it might be worthwhile to consider changing the regex line to allow for the following: (I don't know for sure, but I think some/most of these would be required to make things properly HTML compliant)

  • the tag "form" to be upper or lower case
  • the attribute "method" to be upper or lower case
  • the value "POST" to be upper or lower case
  • the value "POST" to be surrounded by single, double or no quotation marks.

-- MatthewDent - 23 Dec 2009

FYI the case of the HTML is irrelevant - it's a case insensitive regex, as indicated by the /i suffix.

I updated HowToIntegrateWithRequestValidation your other point.

-- CrawfordCurrie - 06 Jun 2010

ItemTemplate edit

Summary strikeone and custom HTML forms
ReportedBy MatthewDent
Codebase 1.0.7
SVN Range
AppliesTo Engine
Component Documentation
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r2 - 06 Jun 2010, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy