Skip to content

Commit

Permalink
Merge pull request #89 from stevepiercy/master
Browse files Browse the repository at this point in the history
add maxlength, size; fix bug w/undefined local
  • Loading branch information
stevepiercy committed Oct 21, 2013
2 parents 1a7599b + d7e6537 commit cab8c2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion knop8/source/_ctype/form.inc
Expand Up @@ -1669,8 +1669,9 @@ Option for -> renderhtml to output without html encoding
/iterate;
/if;
// if field is required, use the required marker of the form
local('required' = string);
if(#onefield -> find('required'));
local('required' = self -> 'required');
#required = self -> 'required';
/if;
local('tw') = \#widget;
#renderrow = #tw->run(
Expand All @@ -1681,8 +1682,10 @@ Option for -> renderhtml to output without html encoding
-errorclass = #onefield -> find('errorclass'),
-id = #id,
-label = #onefield -> find('label'),
-maxlength = #onefield -> find('maxlength'),
-placeholder = #onefield -> find('placeholder'),
-required = #required,
-size = #onefield -> find('size'),
-value = encode_html(#fieldvalue),
-encodenone
));
Expand Down
6 changes: 5 additions & 1 deletion knop8/source/tpl/inputtexttb3.inc
Expand Up @@ -9,8 +9,10 @@ define_tag('inputtexttb3',
-optional='errorclass',
-optional='id',
-optional='label',
-optional='maxlength',
-optional='placeholder',
-optional='required',
-optional='size',
// -optional='title',
-optional='value'
);
Expand All @@ -28,8 +30,10 @@ define_tag('inputtexttb3',
#t_id = ' id="' + #id + '"';
/if;
!local_defined('label') ? local('label') = #name;
local_defined('maxlength') && #maxlength != '' ? local('t_maxlength' = ' maxlength="' + #maxlength + '"') | local('t_maxlength');
local_defined('placeholder') && #placeholder != '' ? local('t_placeholder' = ' placeholder="' + #placeholder + '"') | local('t_placeholder');
!local_defined('required') ? local('required');
local_defined('size') && #size != '' ? local('t_size' = ' size="' + #size + '"') | local('t_size');

// !local_defined('title') ? local('title');
local_defined('value') ? local('t_value' = ' value="' + #value + '"') | local('t_value');
Expand All @@ -44,7 +48,7 @@ define_tag('inputtexttb3',
<div class="control-group'+ #ec + '">
<label class="control-label"' + #for + '>' + #label + #required + '</label>
<div class="controls">
<input type="text"' + #t_name + #t_value + #t_id + #t_class + #t_placeholder + '>' + #em + '
<input type="text"' + #t_name + #t_class + #t_id + #t_maxlength + #t_placeholder + #t_size + #t_value + '>' + #em + '
</div>
</div>
';
Expand Down

0 comments on commit cab8c2b

Please sign in to comment.