For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

value

Returns the the current value of the named form input field.  Can also set a new value within the current page.

Summary

  • [value name]

Parameter Description Default
name The name of the form variable whose value you want. None
default Return this value if the named form variable is missing or false. No
enable_html Allow "<" characters to remain intact in the returned value. No
enable_itl Allow "[" characters to remain intact in the returned value. No
filter Modify the form variable's value (persistent unless keep is also specified). None
keep For use with the filter parameter No
scratch Place a copy of the value in the scratchpad. No
set Set a new value for the named form variable. None
hide Don't return the value (useful if set is also used). No
interpolate

Process any Interchange tags found in the text output from this tag.

No

Examples

Tag expansion example

Assuming the value of the form variable "foo" is "bar": 

[value foo]
bar

Perl example

$Tag->value({
    name => 'foo',
});

or similarly with positional parameters:

$Tag->value('foo', $attribute_hash_reference);

The following lookup from the $Values hash reference is more efficient than calling $Tag->value(), and yields the same result:

my $result = $Values->{$name};

Description

Returns the the current value of the named form variable.  This is similar to [cgi], except it displays saved form values, rather than any transitory CGI values that have been submitted with the current request.

When the value is returned, any Interchange tags and HTML present in the value will be escaped.  This prevents users from entering Interchange tags in form fields, which could be a serious security risk.  It also helps prevent HTML injection attacks.

This tag can also set a new value within the current page, using the set parameter, described below.

This is the same as $Values->{foo} in embedded Perl.

A value can be initialised to a default using the ValuesDefault local (catalog.cfg) configuration directive.

Also see the [value-extended] tag.

Parameters

name

This is the name of the form variable whose value you want.

default

This sets a return value in case the named form variable is missing or otherwise false.  The following will expand to "Using default":

[value name="myname" set="" hide=1]
[value name="myname" default="Using the default"]

enable_html

Any "<" characters, found in the output value, will normally be converted into "&lt;" for safety reasons.  This conversion can be disabled by setting the "enable_html" parameter true.

enable_itl

Any "[" characters, found in the output value, will normally be converted into "&#91;" for safety reasons.  This conversion can be disabled by setting the "enable_itl" parameter true.

filter

Setting filter="filter1 filter2" modifies the named form variable by running it through the specified filter(s).

See the filters category for a list of standard filters.

keep

Set keep=1 if you want the tag to return a filtered result but do not want the filter to modify the CGI value itself in the $Values hashref.

scratch

Place a copy of the value in the scratchpad.  For example:

foo is [value name="foo" scratch=1] in the $Values hash.
foo is now also [scratch foo] in the $Scratch hash.
---
foo is bar in the $Values hash.
foo is now also bar in the $Scratch hash.

set

You can change a value with set="new_value".  The tag will return the new value you set unless you also pass the hide=1 parameter.

hide

Setting hide=1 suppresses the tag's return value, which can be useful with the set attribute.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Thursday 27 December 2007 at 5:52 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us