default — (deprecated) return content of the named form input field, defaulting to value 'default'
| Attribute | Pos. | Req. | Default | Description |
|---|---|---|---|---|
| name | Yes | Yes | Name of the form variable. | |
| default | Yes | Yes |
default
|
Default value to return if the specified variable is missing or evaluates to a false value. |
| 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? | ||
| 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.
This tag is very similar to [value], except that it provides the
default value for the default= parameter.
Example: displaying user's first name in a modifiable field
<form action="[process]"> Hello, <input type="text" name="fname" value="[default fname Anonymous]" />! </form>
TODO: Add a submit button
Example: displaying user's first name, or falling back to the default
Hello, [default fname Anonymous]!
Interchange 5.9.0:
Source: code/SystemTag/default.coretag
Lines: 23
# 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: default.coretag,v 1.5 2007-03-30 23:40:49 pajamian Exp $
UserTag default Order name default
UserTag default addAttr
UserTag default PosNumber 2
UserTag default Version $Revision: 1.5 $
UserTag default Routine <<EOR
# Returns the text of a user entered field named VAR.
# Same as tag [value name=name default="string"] except
# returns 'default' if not present
sub {
my($var, $default, $opt) = @_;
$opt->{default} = !(length $default) ? 'default' : $default;
return tag_value($var, $opt);
}
EOR