Detailed Description

Default creditcard fieldset.

Class to get a user creditcard information. It generates a fieldset that consists of

  • a creditcard-type (like 'Visa', 'MasterCard' or 'American Express')
  • a field for the creditcard-number
  • a field for the expiry-date
  • a field for the card-owner

At the moment this input only checks the formatting of the numbers but not, if it is a valid creditcard.

Usage

<?php
$form = new depage\htmlform\htmlform('myform');
// add a creditcard fieldset
$form->addCreditcard('creditcard', array(
'label' => 'Credit Card',
));
// process form
$form->process();
// Display the form.
echo ($form);

Definition at line 45 of file creditcard.php.

Inheritance diagram for creditcard:

Public Member Functions

 addChildElements ()
 adds creditcard-inputs to fieldset More...
 
 validate ()
 Validate the creditcard data. More...
 
- Public Member Functions inherited from fieldset
 addElement ($type, $name, $parameters)
 Generates sub-elements. More...
 
 __toString ()
 Renders the fieldset to HTML code. More...
 
- Public Member Functions inherited from container
 __construct ($name, $parameters, $form)
 container class constructor More...
 
 __call ($function, $arguments)
 HTML escaping and add subelements. More...
 
 addChildElements ()
 Sub-element generator hook. More...
 
 addHtml ($html)
 Adds a new custom HTML element to the container. More...
 
 addStepNav ($parameter=array())
 Adds automatic step navigation to output. More...
 
 validate ()
 Validates container and its contents. More...
 
 setRequired ($required=true)
 Sets required-attribute. More...
 
 getElements ($includeFieldsets=false)
 Returns containers subelements. More...
 
 getElement ($name)
 Gets subelement by name. More...
 
 clearValue ()
 Deletes values of all child elements. More...
 
- Public Member Functions inherited from element
 __construct ($name, $parameters, $form)
 element class constructor More...
 
 __call ($function, $arguments)
 HTML escaping. More...
 
 clearValue ()
 resets the value to null More...
 
 getName ()
 Returns the element name. More...
 

Protected Member Functions

 setDefaults ()
 collects initial values across subclasses. More...
 
- Protected Member Functions inherited from fieldset
 setDefaults ()
 collects initial values across subclasses. More...
 
 htmlClasses ()
 Returns string of the elements' HTML-classes, separated by spaces. More...
 
- Protected Member Functions inherited from container
 addElement ($type, $name, $parameters)
 Generates sub-elements. More...
 
- Protected Member Functions inherited from element
 setDefaults ()
 Collects initial values across subclasses. More...
 
 checkParameters ($parameters)
 checks element parameters More...
 
 log ($argument, $type=null)
 error & warning logger More...
 
 htmlEscape ($options=array())
 Escapes HTML in strings and arrays of strings. More...
 

Additional Inherited Members

- Data Fields inherited from element
 $valid
 Contains element validation status/result. More...
 
- Protected Attributes inherited from fieldset
 $form
 parent HTML form. More...
 
- Protected Attributes inherited from container
 $elements = array()
 References to input elements and fieldsets. More...
 
 $elementsAndHtml = array()
 Input element, fieldset and custom HTML object references. More...
 
 $form
 Parent form object reference. More...
 
- Protected Attributes inherited from element
 $name
 Element name. More...
 
 $validated = false
 True if the element has been validated before. More...
 
 $log
 Log object reference. More...
 

Member Function Documentation

addChildElements ( )

adds creditcard-inputs to fieldset

Todo:
check regular expressions based on (?): http://www.regular-expressions.info/creditcard.html
Returns
void

Definition at line 79 of file creditcard.php.

setDefaults ( )
protected

collects initial values across subclasses.

The constructor loops through these and creates settable class attributes at runtime. It's a compact mechanism for initialising a lot of variables.

Returns
void

Definition at line 56 of file creditcard.php.

validate ( )

Validate the creditcard data.

Todo:

validate based on (?): http://www-sst.informatik.tu-cottbus.de/~db/doc/Java/GalileoComputing-JavaInsel/java-04.htm#t321

validate specific to cardtype

Returns
bool validation result

Definition at line 129 of file creditcard.php.


The documentation for this class was generated from the following file: