NAME HTML::Prototype - Generate HTML and Javascript for the Prototype library SYNOPSIS use HTML::Prototype; my $prototype = HTML::Prototype->new; print $prototype->auto_complete_field(...); print $prototype->auto_complete_result(...); print $prototype->auto_complete_stylesheet(...); print $prototype->content_tag(...); print $prototype->define_javascript_functions; print $prototype->draggable_element(...); print $prototype->drop_receiving_element(...); print $prototype->evaluate_remote_response(...); print $prototype->form_remote_tag(...); print $prototype->javascript_tag(...); print $prototype->link_to_function(...); print $prototype->link_to_remote(...); print $prototype->observe_field(...); print $prototype->observe_form(...); print $prototype->periodically_call_remote(...); print $prototype->sortable_element(...); print $prototype->submit_to_remote(...); print $prototype->tag(...); print $ptototype->update_element_function(...); print $prototype->visual_effect(...); DESCRIPTION Some code generators for Prototype, the famous JavaScript OO library and the script.aculous extensions. This library allows you to do Ajax without writing lots of JavaScript code. This is mostly a port of the Ruby on Rails helper tags for JavaScript for use in Catalyst. METHODS $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
New product!
' ) ); This method can also be used in combination with remote method call where the result is evaluated afterwards to cause multiple updates on a page. Example: # View $prototype->form_remote_tag( { url => { "http://foo.bar/buy" }, complete => $prototype->evaluate_remote_response } ); # Returning view $prototype->update_element_function( 'cart', { action => 'update', position => 'bottom', content => "New Product: $product_name
" } ); $prototype->update_element_function( 'status', { binding => "You've bought a new product!" } ); $prototype->visual_effect( $name, $element_id, \%js_options ) Returns a JavaScript snippet to be used on the Ajax callbacks for starting visual effects. $prototype->link_to_remote( 'Reload', { update => 'posts', url => 'http://foo.bar/baz', complete => $prototype->visual_effect( 'highlight', 'posts', { duration => '0.5' } ) } ); SEE ALSO Catalyst::Plugin::Prototype, Catalyst.