NAME
XAO::DO::Web::FilloutForm - support for HTML forms
DESCRIPTION
Fill out form object. Helps to create fill-out forms for registration and so on. Checks that parameters are Ok and then displays either form or thanks.
Must be overriden with something which will put 'fields' parameter into $self. Format is as array of hash references reference of the following structure:
[ { name => field name
, required => 0 || 1
, style => selection || text || email || phone || integer ||
dollars || real
, maxlength => maximum length
, minlength => minimum length
, param => name of parameter for form substitution
, text => description of parameter
},
{ ... }
]
If you do not care in what order fields are checked you can also supply 'fields' as a hash reference:
{ name => { required => 0 || 1
, style => text || email || phone || integer || dollars || real
, maxlength => maximum length
, minlength => minimum length
, param => name of parameter for form substitution
, text => description of parameter
},
name1 => { ... }
}
When form filled out "form_ok" method is called, which must be overridden in inherited object to do something good with results. Alternatively reference to subroutine can be given through 'setup' method. This is suitable for using FilloutForm object without overriding it.
Displays form with PARAM.VALUE set to value, PARAM.NAME - to name, PARAM.TEXT - to text and PARAM.HTML - to piece of HTML code if applicable (Country selection for example).
METHODS
- new (%)
-
Overrided new method for those who prefer to use inheritance style.
- setup_fields (%)
-
Copying fields descriptions. We copy entire structure here because it could be persistent and we do not want original data to be modified.
- display (%)
-
Displaying the form.
- pre_check_form (%)
-
Pre-checking form. May be used if some values are calculated or copied from another and should be checked later.
Should stuff generated values into {newvalue} parameter.
- countries_list ()
-
Returns list of countries for selection. May be overriden if site needs only a fraction of that.
- us_continental_states_list ()
-
Returns list of US continental states for selection. May be overriden if site needs only a fraction of that.
- us_states_list ()
-
Returns list of US states for selection. May be overriden if site needs only a fraction of that.
AUTHORS
Copyright (C) 2000-2001, XAO Inc; Andrew Maltsev <am@xao.com>