public static function createForm() { $form = new \Ip\Form(); $form->addAttribute('autocomplete', 'off'); $field = new \Ip\Form\Field\Text(array('name' => 'username', 'label' => __('User name', 'Ip-admin', false))); $field->addValidator("Required"); $field->addValidator(array('Unique', array('table' => 'administrator'))); $form->addField($field); $field = new \Ip\Form\Field\Text(array('name' => 'email', 'label' => __('Email', 'Ip-admin', false))); $field->addValidator("Required"); $form->addField($field); $field = new \Ip\Form\Field\Password(array('name' => 'password', 'label' => __('Password', 'Ip-admin', false))); $field->addValidator("Required"); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'Administrators.add')); $form->addField($field); return $form; }
public static function getPasswordResetForm2() { //create form object $form = new \Ip\Form(); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Admin.passwordResetAjax2')); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'secret', 'value' => ipRequest()->getQuery('secret', ''))); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'userId', 'value' => ipRequest()->getQuery('id', ''))); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Blank(array('name' => 'global_error')); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Password(array('name' => 'password', 'label' => __('New password', 'Ip-admin', false))); $field->addValidator('Required'); $form->addField($field); //add text field to form object $field = new \Ip\Form\Field\Submit(array('value' => __('Save', 'Ip-admin', false))); $field->addClass('ipsLoginButton'); $form->addField($field); $form->addClass('ipsPasswordResetForm2'); return $form; }