HTML-Prototype
view release on metacpan or search on metacpan
"load_text_url": Will cause the text to be loaded from the server
(useful if your text is actually textile and formatted on the
server)
"loading_text": If the "load_text_url" option is specified then this
text is displayed while the text is being loaded from the server.
(default: "Loading...")
"click_to_edit_text": The text on the click-to-edit link. (default:
"click to edit")
"external_control": The id of an external control used to enter edit
mode.
"ajax_options": Pass through options to the AJAX call (see
prototype's Ajax.Updater)
"with": JavaScript snippet that should return what is to be sent in
the Ajax call, "form" and "value" are implicit parameters
$prototype->in_place_editor_field( $object, $method, \%tag_options,
\%in_place_editor_options )
Renders the value of the specified object and method with in-place
editing capabilities.
$prototype->in_place_editor_stylesheet
Returns the in_place_editor stylesheet.
$prototype->auto_complete_field( $field_id, \%options )
Adds Ajax autocomplete functionality to the text input field with
the DOM ID specified by $field_id.
This function expects that the called action returns a HTML <ul>
list, or nothing if no entries should be displayed for
autocompletion.
Required options are:
"url": Specifies the URL to be used in the AJAX call.
Addtional options are:
"update": Specifies the DOM ID of the element whose innerHTML should
be updated with the autocomplete entries returned by the Ajax
request. Defaults to field_id + '_auto_complete'.
"with": A Javascript expression specifying the parameters for the
XMLHttpRequest. This defaults to 'value', which in the evaluated
context refers to the new field value.
"indicator": Specifies the DOM ID of an elment which will be
displayed Here's an example using Catalyst::View::Mason with an
indicator against the auto_complete_result example below on the
server side. Notice the 'style="display:none"' in the indicator
<span>.
<% $c->prototype->define_javascript_functions %>
<form action="/bar" method="post" id="baz">
<fieldset>
<legend>Type search terms</legend>
<label for="acomp"><span class="field">Search:</span></label>
<input type="text" name="acomp" id="acomp"/>
<span style="display:none" id="acomp_stat">Searching...</span><br />
</fieldset>
</form>
<span id="acomp_auto_complete"></span><br/>
<% $c->prototype->auto_complete_field( 'acomp', { url => '/autocomplete', indicator => 'acomp_stat' } ) %>
while autocomplete is running.
"tokens": A string or an array of strings containing separator
tokens for tokenized incremental autocompletion. Example: "<tokens
=" ','>> would allow multiple autocompletion entries, separated by
commas.
"min_chars": The minimum number of characters that should be in the
input field before an Ajax call is made to the server.
"on_hide": A Javascript expression that is called when the
autocompletion div is hidden. The expression should take two
variables: element and update. Element is a DOM element for the
field, update is a DOM element for the div from which the innerHTML
is replaced.
"on_show": Like on_hide, only now the expression is called then the
div is shown.
"select": Pick the class of the element from which the value for
insertion should be extracted. If this is not specified, the entire
element is used
$prototype->auto_complete_result(\@items, $fieldname, [$phrase])
Returns a list, to communcate with the Autocompleter.
Here's an example for Catalyst:
sub autocomplete : Global {
my ( $self, $c ) = @_;
my @items = qw/foo bar baz/;
$c->res->body( $c->prototype->auto_complete_result(\@items) );
}
$prototype->text_field_with_auto_complete($method, [\%tag_options],
[\%completion_options])
Wrapper for text_field with added Ajax autocompletion functionality.
In your controller, you'll need to define an action called
auto_complete_for_object_method to respond the AJAX calls,
$prototype->auto_complete_stylesheet
Returns the auto_complete stylesheet.
$prototype->content_tag( $name, $content, \%html_options )
Returns a block with opening tag, content, and ending tag. Useful
for autogenerating tags like <a
href="http://catalyst.perl.org"Catalyst Homepage</a>>. The first
parameter is the tag name, i.e. 'a' or 'img'.
( run in 0.990 second using v1.01-cache-2.11-cpan-39bf76dae61 )