For more information... RTFM!
NAVIGATION
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

button

Creates a HTML form submit button.

Summary

  • [button name src text] ... [/button]

Parameter Description Default
name Button (HTML <input> field) name. mv_click
src Image file to use. None
text Button text. None
alt Alternate text for the image src. None
anchor HTML anchor name, if using an image as the submit button. None
confirm Text to use in a JavaScript button click confirmation dialog. None
extra String containing attributes to be passed to the resulting HTML tag. None
form The name of the form that this button will submit. See parameter description
getsize Determine the image size automatically. No
hidetext Suppress the button text. No
wait_text Button text to show while the next page is being loaded.  
border, height, width, hspace, vspace and align Ordinary HTML attributes for the resulting HTML tag. None
id, class and style Ordinary CSS attributes for the resulting HTML tag. None | None
hide

Suppress any output text that would ordinarily be returned from this tag.  (This universal parameter was introduced with Interchange version 5.5.2.)

No
interpolate

Parse Interchange tags, included in the body text, before this container tag executes.

No
reparse

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

Yes

Examples

Tag expansion example

[button text="Delete item" confirm="Are you sure?"]
    [any-tag] use any Interchange tags [/any-tag]
    [perl] # use Perl if you prefer [/perl]
[/button]
[set Delete item]
    [any-tag] use any Interchange tags [/any-tag]
    [perl] # use Perl if you prefer [/perl]
[/set]

<input type="submit" name="mv_click" value="Delete item" onclick="return confirm('Are you sure?')">

Perl example

$Tag->button({
    name => $name,
    src => $src,
    text => $text,
});

or similarly with positional parameters:

$Tag->button($name, $src, $text, $attribute_hash_reference);

Description

This tag can be used to render a standard HTML submit button, or a graphical button, to the page.

Standard text-only submit buttons are created using the <input> HTML tag.

Graphical buttons are created using the <a> and <img> HTML tags, along with a block of JavaScript to handle the submission.

This tag has parameters that can be used to create button enhancements, such as a confirmation dialog.

Parameters

name

The name given to the HTML <input> field.  The default is "mv_click".

src

If set to an image file that exists then this tag will generate JavaScript and HTML to allow the image to be used as a submit button.  If the named image file does not exist, or is not readable, then the text parameter will be used to build a standard HTML submit button.

If the value starts with "http://" or "https://" then it will be used as-is and no existence checks will be performed.

The following tag call

[button text="Delete item" confirm="Are you sure?" src="delete.gif"]
    [any-tag] use any Interchange tags [/any-tag]
    [perl] # use Perl if you prefer [/perl]
[/button]
Would produce the following output

[set Delete item]
    [any-tag] use any Interchange tags [/any-tag]
    [perl] # use Perl if you prefer [/perl]
[/set]

<script language="javascript1.2">
<!--
    function mv_click_map_unique(myform, clickname, clicktext) {
        for (var i = 0; i < myform.length; i++) {
            var widget = myform.elements[i];

            if (widget.type == 'hidden' && widget.name != 'mv_click_map' && widget.name.indexOf('mv_click_') == 0)
                    widget.value = (widget.name == clickname) ? clicktext : '';
        }
        return true;
    }
    document.write('<input type=\'hidden\' name=\'mv_click_map\' value=\'Delete_item\'><input type=\'hidden\' name=\'mv_click_Delete_item\' value=\'\'><a href="javascript: void 0" onMouseOver="window.status=\'Delete item\'" onClick="confirm(\'Are you sure?\') && mv_click_map_unique(document.forms[0], \'mv_click_Delete_item\', \'Delete item\') && forms[0].submit(); return(false);" alt="Delete item"><img alt="Delete item" src="delete.gif" border=\'0\' align=\'top\'></a><b>Delete&nbsp;item</b> ');
// -->
</script>
<noscript><input type="submit" name="mv_click" value="Delete item" onclick="return confirm('Are you sure?')"></noscript>

text

The label for the standard HTML <input> button, if a graphic filename or URI is not provided.  See the src parameter.

This text will be used as the name of the scratchpad variable that will hold the callback code associated with the button.  Also see the wait_text parameter.

alt

Alternate text for the browser to show if the image can't be displayed, for whatever reason.  This is also shown on the status bar and in tooltips, when the image is in focus.

anchor

HTML anchor name, if using an image as the submit button.

confirm

If defined then the tag will produce a JavaScript confirmation dialog when the button is clicked.  This parameter's value will be shown in the confirmation dialog.  The form will only be submitted if the user confirms the click.

extra

Anything included in this parameter will be used verbatim as extra parameters to the generated HTML <img> tag (for image buttons) or <input> tag (for standard buttons).

form

The name of the form that this button will submit.  Defaults to the first form on the page.  Naming forms is recommended to avoid unpredictable results.

getsize

If this parameter is set true, and the

Image::Size Link to an external page Perl module is installed, then this tag will use it to determine the image's height and width, so that they can be added to the resulting HTML <img> tag without having to be specified.

This parameter will override the values specified using the height and width parameters.

Warning

Warning

If you call this tag from local embedded Perl then you will not be able to use this parameter without also untrapping the "require" opcode.  See the SafeUntrap global configuration directive.

This parameter will be ignored if the src parameter refers to an external URI.

hidetext

Set true to suppress the text output.

wait_text

Text to show while the next page is being loaded, to help prevent undesired multiple clicks on the button.

If defined then this will be used, instead of the text parameter's value, to name the scratchpad variable that will hold the callback code associated with the button.

border

Ordinary HTML attribute for the resulting HTML tag.

height

Ordinary HTML attribute for the resulting HTML tag.

Note

Note

This parameter's value will be ignored if the getsize parameter is set true.

width

Ordinary HTML attribute for the resulting HTML tag.

Note

Note

This parameter's value will be ignored if the getsize parameter is set true.

hspace

Ordinary HTML attribute for the resulting HTML tag.

vspace

Ordinary HTML attribute for the resulting HTML tag.

align

Ordinary HTML attribute for the resulting HTML tag.

id

Ordinary CSS attribute for the resulting HTML tag.

class

Ordinary CSS attribute for the resulting HTML tag.

style

Ordinary CSS attribute for the resulting HTML tag.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Thursday 9 August 2007 at 12:02 PM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us