<?
class frmEditMask extends MForm
{
    public function __construct()
    {   
		global $page;

		parent::__construct('EditMask Sample');
        $this->eventHandler(); 
	}

	function CreateFields()
	{
	   $fields = array(
           new MTextHeader('1','','MÃ¡scaras'),
           new MTextHeader('2','','# - [0-9] &nbsp;&nbsp;&nbsp;a - [a-z][0-9] &nbsp;&nbsp;&nbsp;A - [A-Z][0-9] &nbsp;&nbsp;&nbsp;l - [a-z] &nbsp;&nbsp;&nbsp;L - [A-Z]'),
           new MSpacer('10px'),
           new MTextField('mask1','','Mask1',20,'mask: #### - obrig'),
           new MTextField('mask2','','Mask2',20,'mask: ##/##/####'),
           new MTextField('mask3','','Mask3',20,'mask: (##)####-####'),
           new MTextField('mask4','12-34','Mask4',20,'mask: #####-### - obrig'),
           new MTextField('mask5','','Mask5',20,'mask: ###.###.###,##'),
           new MTextField('mask6','','Mask6',20,'mask: aaa##.aa'),
           new MTextField('mask7','','Mask7',20,'mask: AAA####-AA'),
           new MTextField('mask8','','Mask8',20,'mask: aall##AALL'),
       );
       $this->setFields($fields);
       $this->mask1->addMask('####',false);
       $this->mask2->addMask('##/##/####');
       $this->mask3->addMask('(##)####-####');
       $this->mask4->addMask('#####-###',false);
       $this->mask5->addMask('###.###.###,##', true,'Valor invÃ¡lido');
       $this->mask6->addMask('aaa##.aa');
       $this->mask7->addMask('AAA####-AA');
       $this->mask8->addMask('aall##AALL');
	}

    public function submit_button_click()
    {
       $this->addField(new MLabel($this->getFieldValue('mask1'))); 
       $this->addField(new MLabel($this->getFieldValue('mask2'))); 
       $this->addField(new MLabel($this->getFieldValue('mask3'))); 
       $this->addField(new MLabel($this->getFieldValue('mask4'))); 
       $this->addField(new MLabel($this->getFieldValue('mask5'))); 
       $this->addField(new MLabel($this->getFieldValue('mask6'))); 
       $this->addField(new MLabel($this->getFieldValue('mask7'))); 
       $this->addField(new MLabel($this->getFieldValue('mask8'))); 
    }
}

?>
