value — return content of the named form input field
| Attribute | Pos. | Req. | Default | Description |
|---|---|---|---|---|
| name | Yes | Yes | Name of the form variable | |
| values_space | Specify "values space" in which to perform the operation. | |||
| set | Set form field variable value to the specified content. | |||
| filter | Apply specified filter to the variable content. The application of a filter actually modifies the variable value in-place (in addition to, of course, displaying the filtered content). | |||
| keep | 0 | Only apply filter for display, and do not modify actual variable value? | ||
| scratch | 0 | Along with setting a form field value, also create the variable/content pair in the scratch space? | ||
| default | Default value to return if the specified variable is missing or evaluates to a false value. | |||
| enable_itl | 0 |
Allow ITL tags to appear in the output? By default, all
"[" characters are encoded as
"[".
|
||
| enable_html | 0 |
Allow HTML tags to appear in the output? By default, all
"<" characters are encoded as
"<".
|
||
| interpolate | 0 | interpolate output? | ||
| hide | 0 | Hide the tag return value? |
The tag returns the named form input field value. Any Interchange tags in the output are HTML- and ITL-escaped by default for security reasons.
Using the set= attribute, you can also set values.
Example: displaying user's first name in a modifiable field
<form action="[process]"> Hello, <input type="text" name="fname" value="[value fname]" />! </form>
TODO: Add a submit button
Example: displaying user's first name, or falling back to the default
Hello, [value name=fname default=Anonymous]!
Example: setting a value along with a copy in the scratch space
[value name=fname set=Mirko scratch=1 hide=1] Hello, [scratch fname]! I hear this is your new name.
Interchange 5.7.0:
Source: code/SystemTag/value.coretag
Lines: 15
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: value.coretag,v 1.7 2008-07-04 15:52:35 mheins Exp $ UserTag value Order name UserTag value addAttr UserTag value PosNumber 1 UserTag value Version $Revision: 1.7 $ UserTag value MapRoutine Vend::Interpolate::tag_value UserTag evalue Alias value keep=1 filter="encode_entities" name=
Source: lib/Vend/Interpolate.pm (rev. 2.310 from Sat Dec 6 00:01:23 2008)
Lines: 2560
sub tag_value {
my($var,$opt) = @_;
#::logDebug("called value args=" . uneval(\@_));
local($^W) = 0;
my $vspace = $opt->{values_space};
my $vref;
if (defined $vspace) {
if ($vspace eq '') {
$vref = $Vend::Session->{values};
}
else {
$vref = $Vend::Session->{values_repository}{$vspace} ||= {};
}
}
else {
$vref = $::Values;
}
$vref->{$var} = $opt->{set} if defined $opt->{set};
my $value = defined $vref->{$var} ? $vref->{$var} : '';
$value =~ s/\[/[/g unless $opt->{enable_itl};
if($opt->{filter}) {
$value = filter_value($opt->{filter}, $value, $var);
$vref->{$var} = $value unless $opt->{keep};
}
$::Scratch->{$var} = $value if $opt->{scratch};
return '' if $opt->{hide};
return $opt->{default} if ! $value and defined $opt->{default};
$value =~ s/</</g unless $opt->{enable_html};
return $value;
}
Source: lib/Vend/Interpolate.pm (rev. 2.310 from Sat Dec 6 00:01:23 2008)
Lines: 2560
sub tag_value {
my($var,$opt) = @_;
#::logDebug("called value args=" . uneval(\@_));
local($^W) = 0;
my $vspace = $opt->{values_space};
my $vref;
if (defined $vspace) {
if ($vspace eq '') {
$vref = $Vend::Session->{values};
}
else {
$vref = $Vend::Session->{values_repository}{$vspace} ||= {};
}
}
else {
$vref = $::Values;
}
$vref->{$var} = $opt->{set} if defined $opt->{set};
my $value = defined $vref->{$var} ? $vref->{$var} : '';
$value =~ s/\[/[/g unless $opt->{enable_itl};
if($opt->{filter}) {
$value = filter_value($opt->{filter}, $value, $var);
$vref->{$var} = $value unless $opt->{keep};
}
$::Scratch->{$var} = $value if $opt->{scratch};
return '' if $opt->{hide};
return $opt->{default} if ! $value and defined $opt->{default};
$value =~ s/</</g unless $opt->{enable_html};
return $value;
}