CGI::FormMagick::Utils

Utility routines for FormMagick
Download

CGI::FormMagick::Utils Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Gordon Rowell
  • Publisher web site:
  • http://search.cpan.org/~mitel/

CGI::FormMagick::Utils Tags


CGI::FormMagick::Utils Description

Utility routines for FormMagick CGI::FormMagick::Utils is a Perl module with utility routines for FormMagick.debug_msg($msg)The debug method prints out a nicely formatted debug message. It can be called from your script as $f-debug_msg($msg) >$fm->get_page_by_name($name)get a page given the name attribute. Returns the numeric index of the page, suitable for $wherenext.$fm->get_page_by_number($page_index)Given a page index, return a hashref containing the page's data. This is just a convenience function.pop_page_stack($self)pops the last page off the stack of pages a user's visited... used when the user clicks "Previous"removes the last element from the stack (modifying it in place in $self->{page_stack}) and returns the element it removed. eg: # if the CGI "pagestack" parameter is "1,2,3,5"... my $page = $self->pop_page_stack(); $self->{page_stack} will be 1,2,3 $page will be 5push_page_stack($newpage)push a new page onto the page stack that keeps track of where a user has been.$fm->parse_template($filename)parses a Text::Template file and returns the result. Will return undef if the filename is invalid.is_last_page()Figures out whether or not we're on the last page. Used by print_buttons() in particular to tell whether to print a Finish button, and to tell whether to do the form post-event.is_first_page()Figures out whether or not we're on the first page. Used mostly to figure out whether we want to do the form pre-event.just_starting()Like is_first_page, but also checks for the absence of a "page" parameter in the CGI, which would indicate that this is the very first page we've looked at.finishedFigures out whether the user's finished. This could be because they clicked "Finish" or it could be because they were on the last page and hit enter.This bears the same relationship to is_last_page as just_starting does to is_first_page.user_pressed_enter()A weirdness in the HTML spec and/or browser implementations thereof means that hitting "enter" on a single-text-field form will submit the form without any value being passed. Worse yet, at least one browser is reported to automatically choose the first submit button on the form, in our case "Previous", which is just WRONG but I can't see any way to work around that.So this routine tells you if the user just hit enter. Returns 1 if they did, or 0 otherwise.$fm->form()Gets the form we're dealing with. With no args, returns an hashref to the form data structure.$fm->page()Gets the current page we're dealing with, as a hashref.get_page_enctypeReturns the appropriate encoding type for this page. A page that uses FILE fields must also use the multipart/form-data encoding type. Any other page may use either, but the default is to use the older and more compatible application/x-www-urlencoded.$self->clear_navigation_params()Clear out the nagivation params Next, Previous, Finish and wherenext. Otherwise they stick around in CGI::Persistent and cause havoc next time you try to navigate.SYNOPSIS use CGI::FormMagick; Requirements: · Perl


CGI::FormMagick::Utils Related Software