Skip to content
Permalink
Browse files

Allow empty legend to render fieldset and legent. Don't render form o…

…pening and closing tags if formaction is not specified (knop8 compatibility)
  • Loading branch information...
johansolve committed Jun 20, 2016
1 parent db2c0b2 commit 151b5ba3d0dbeb7b3903c21649a485b7de030dcb
Showing with 9 additions and 5 deletions.
  1. +9 −5 knop9/knoplibs/knop_form.lasso
@@ -4,6 +4,8 @@
define knop_form => type {
/*
2016-06-20 JS Allow empty legend to render fieldset and legent (knop8 compatibility)
2016-06-20 JS Don't render form opening and closing tags if formaction is not specified (knop8 compatibility)
2016-06-16 JS Disable _unknownTag
2014-03-13 JC Enhanced handling of required markup
2013-11-26 JC Added date to valid field types
@@ -48,7 +50,7 @@ define knop_form => type {
*/
parent knop_base
data public version = '2016-06-16'
data public version = '2016-06-20'
// instance variables
data public fields::array = array
@@ -1339,7 +1341,7 @@ Outputs HTML for the form fields, a specific field, a range of fields or all fie
to = 0,
type = '',
excludetype = '',
legend::string = '',
legend::any = false,
// xhtml::boolean = false,
onlyformcontent::boolean = false,
bootstrap::boolean = false
@@ -1384,7 +1386,9 @@ Outputs HTML for the form fields, a specific field, a range of fields or all fie
local(required_field = false)
// local(endslash = (.xhtml(params) ? ' /' | ''))
if(string(.'formaction') -> size == 0) => {
#onlyformcontent=true;
}
#onlyformcontent ? .'start_rendered' = true
if(.'start_rendered' == false) => {
@@ -1437,7 +1441,7 @@ Outputs HTML for the form fields, a specific field, a range of fields or all fie
}
local(requiredmarker = .'required')
local(defaultclass = ( .'class' != '' ? .'class' | ''))
if(#legend -> size > 0) => {
if(#legend !== false) => {
.'render_fieldset2_open' = true
#output -> append('<fieldset>\n' + '<legend>' + #legend + '</legend>\n')
}
@@ -2228,7 +2232,7 @@ Outputs HTML for the form fields, a specific field, a range of fields or all fie
-to = 0, // number index or field name
-type = '', // only output fields of this or these types (string or array)
-excludetype = '', // output fields except of this or these types (string or array)
-legend::string = '', // groups the rendered fields in a fieldset and outputs a legend for the fieldset
-legend::any = false, // groups the rendered fields in a fieldset and outputs a legend for the fieldset
-start::boolean = false,
-end::boolean = false,
-onlyformcontent::boolean = false,

0 comments on commit 151b5ba

Please sign in to comment.
You can’t perform that action at this time.