Beispiel #1
0
 /**
  * Helper function to create a PassworField.  Useful for quick adding it to a ComponentCollection
  *
  * @param string $name The field's HTML name attribute.
  * @param string $label The label text to display next to this field (defaults to '')
  * @param string $id The unique id of this component (defaults to an auto-assigned id).
  * @return PhpExt_Form_PassworField
  */
 public static function createPasswordField($name, $label = null, $id = null)
 {
     $c = new PhpExt_Form_PasswordField();
     $c->setName($name);
     if ($label !== null) {
         $c->setFieldLabel($label);
     }
     if ($id !== null) {
         $c->setId($id);
     }
     return $c;
 }
Beispiel #2
0
global $ari;
$ari->popup = 1;
// no mostrar el main_frame
$field_width = 180;
//ancho de los controles
$grid_id = '';
if (isset($_POST['gid'])) {
    $grid_id = $_POST['gid'];
}
//creacion de controles
//usuario
$txt_usuario = PhpExt_Form_TextField::createTextField("txt_usuario", "Usuario")->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE);
//password
$txt_password = PhpExt_Form_PasswordField::createPasswordField("txt_pass", "Contraseña")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
//repetir password
$txt_repetir = PhpExt_Form_PasswordField::createPasswordField("txt_repetir", "Repetir")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
//e-mail
$txt_email = PhpExt_Form_TextField::createTextField("txt_email", "E-mail", null, PhpExt_Form_FormPanel::VTYPE_EMAIL)->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE);
//Boton actualizar OnClick
$handler_grabar = "\nfunction(){\n\nthis.findParentByType('form').getForm().submit(\n\t{    \n\t\t\treset : true,\n\t\t  waitMsg : 'Enviando Datos',\n\t\twaitTitle : 'Emporika',\n\t  success_msg : 'Usuario creado correctamente',\n  grid_reload_id  : '{$grid_id}'\t\t\t\t \t   \n\t}\t\n\t);\t\t\t\t\n\t\t}";
$btn_grabar = PhpExt_Button::createTextButton("Grabar", new PhpExt_JavascriptStm($handler_grabar));
//JSON_Reader para leer los resultados devueltos
$error_reader = new PhpExt_Data_JsonReader();
$error_reader->setRoot("errors");
$error_reader->setSuccessProperty("success");
$error_reader->addField(new PhpExt_Data_FieldConfigObject("id"));
$error_reader->addField(new PhpExt_Data_FieldConfigObject("msg"));
//formulario que contiene todos los controles
$frm_nuevo_usuario = new PhpExt_Form_FormPanel();
$frm_nuevo_usuario->setUrl("/seguridad/user/new_process")->setErrorReader($error_reader)->setFrame(true)->setWidth(350)->setAutoHeight(true)->setTitle("Datos del usuario")->setMethod(PhpExt_Form_FormPanel::METHOD_POST);
//marco para contenener los controles