<?
class frmSyncToken extends MForm
{
    function __construct()
    {   
        parent::__construct('Sync Token');
        $this->eventHandler();
	}

    public function createFields()
	{
        $fields = Array(
            new MLabel('A Sync Token prevents from submitting the same form twice.','black',true),
            new MSpacer('10px'),
            new MLabel('Click twice on Post button...','black',true),
            new MSpacer('10px'),
        );
        $this->setFields($fields);

        $buttons = new MButton('btnPost','Post');
        $this->setButtons($buttons);
	}

    public function btnPost_click()
    {
        // Maybe a long time-running transaction...
        // Sync Token prevents the user execute twice (clicking twice on button) when the transaction is running yet    
        for($i=0; $i < 10000; $i++)
        {
            for($j=0; $j < 1000; $j++) {}
        }
        $this->addField(new MLabel('End of transaction'));
    }
}

?>