1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default Answered: form validation

    Answered: form validation


    I have this code:

    PHP Code:
    /**
         * Constructor.
         */
        
    public FormularioLogin() {
            
    super();       
            
    setHeaderVisible(false);
            
    setButtonAlign(BoxLayoutPack.CENTER);
            
    //setWidth(350);

            
    form = new FormPanel();

            
    VerticalLayoutContainer p = new VerticalLayoutContainer();
            
    form.add(p);

            
    VerticalLayoutContainer c = new VerticalLayoutContainer();
            
    setWidget(c);


            
    c.add(pnlInformativo, new VerticalLayoutData(1, -1, new Margins(4)));
            
    c.add(pnlErrores, new VerticalLayoutData(1, -1, new Margins(4)));
            
    c.add(pnlExito, new VerticalLayoutData(1, -1, new Margins(4)));
            
    c.add(form, new VerticalLayoutData(1, -1, new Margins(4)));
            
            List<
    DTOTipotipos = new ArrayList<DTOTipo>();
            
    tipos.add(new DTOTipo(1"Paciente"));
            
    tipos.add(new DTOTipo(2"Agente"));
            
    comboBoxTipos = new ComboBoxTipos(tipos);
            
    comboBoxTipos.getCombo().setToolTipConfig(new ToolTipConfig("Tipo""Seleccione el tipo de usuario para loguearse."));
            
    comboBoxTipos.getCombo().setAllowBlank(false);
            
    p.add(new FieldLabel(comboBoxTipos.getCombo(), "Tipo"), new VerticalLayoutData(1, -1));
            
            
    comboBoxTipos.setElegido(new DTOTipo(1"Paciente")); 

            
    txtUsuario = new TextField();
            
    txtUsuario.addValidator(new MinLengthValidator(1));
            
    txtUsuario.addValidator(new MaxLengthValidator(100));
            
    txtUsuario.setToolTipConfig(new ToolTipConfig("Usuario""Digite el usuario"));
            
    txtUsuario.setAllowBlank(false);
            
    txtUsuario.getFocusSupport().setPreviousId(getButtonBar().getId());
            
    p.add(new FieldLabel(txtUsuario"Usuario"), new VerticalLayoutData(1, -1));

            
    txtPassword = new PasswordField();
            
    txtPassword.addValidator(new MinLengthValidator(1));
            
    txtPassword.addValidator(new MaxLengthValidator(100));
            
    txtPassword.setToolTipConfig(new ToolTipConfig("Contraseña""Digite la contraseña del usuario"));
            
    txtPassword.setAllowBlank(false);
            
    p.add(new FieldLabel(txtPassword"Clave"), new VerticalLayoutData(1, -1));

            final 
    TextButton btnAceptar = new TextButton("Aceptar"Iconos.INSTANCE.iconoOk());
            
    btnAceptar.addSelectHandler(listenerLogin());

            
    addButton(btnAceptar);

        }

    /**
         * Escucha el boton de login
         *
         * @return
         */
        
    private SelectHandler listenerLogin() {
            return new 
    SelectHandler() {

                @
    Override
                
    public void onSelect(SelectEvent event) {
                    
    validarLogin();
                }
            };
        }

        
    /**
         * ejecuta validacion de formulario y llamado al RPC de login
         */
        
    private void validarLogin() {
            
    // Se chequea el formulario por errores
            // Si está bien
            
    if (form.isValid() ) { //|| (txtUsuario.isValid() && txtPassword.isValid())
                
    boxWait = new AutoProgressMessageBox("Progreso",
                        
    "Procesando los datos, por favor espere...");
                
    boxWait.setProgressText("Procesando...");
                
    boxWait.auto();
                
    boxWait.show();

                
    //Sigue metodo RPC
            
    } else // Si hay errores
            
    {
                
    pnlErrores.limpiar();
                
    pnlErrores.setVisible(true);
                
    pnlErrores.aniadir("Debe llenar todos los campos");
            }
        } 
    Sometimes when I try to make click in the button "OK", the metod form.isValid() return false then I make click again without any change and the metod form.isValid() return true, since the first try the data are ok.

    PD: sorry for my english

  2. Parece que ya resolvieron el problema en la nueva entraga de GXT 3.0.6

    [EXTGWT-2830] - TextButton doesn't retain focus correctly when clicking on icon

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Answers
    3354
    Vote Rating
    748
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Please stop posting duplicates. I have approved this one and deleted all your other duplicates.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default


    Sorry,

    I hope someone can help me with my problem

  5. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Answers
    107
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Why is form.isValid() returning false the first time? You said it happens sometimes, but what are you doing with the form to make it happen?

    One legitimate way that this could possibly happen is to enter garbage into a date field - when you clear, if clearOnParseError is true, it will clear out the text, so that form.isValid() should be false. If you click in that field again, since it is blank, it is no longer invalid, so form.isValid() should be true.

    Can you provide the exact steps you follow to have this issue? What versions of GXT and GWT are you using?

    Finally, your code isn't runnable - you are missing the rest of the FormularioLogin class, so there could be a bug elsewhere and we would miss it. Without a complete class, we can't even run it without commenting out the parts that can't compile.

  6. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default


    I am using GXT 3.0.4 with GWT 2.4

    The full class is:

    ...

    As I say, that happens sometimes but I have not been able to identify the pattern to this event.

    Thanks in advance.

  7. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Answers
    107
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    It may be the full class, but it isn't usable:

    Code:
    import co.com.boos.client.util.PanelInformativo;
    import co.com.boos.client.util.PanelErrores;
    import co.com.boos.client.util.PanelExito;
    import co.com.boos.client.util.BeansLocales;
    import co.com.boos.client.base.PanelBase;
    import co.com.boos.client.util.rpc.RPCLoginAsync;
    import co.com.boos.client.util.rpc.RPCLogin;
    import co.com.boos.client.datos.dominio.UsuariosAlterno;
    import co.com.boos.client.datos.dto.DTOTipo;
    import co.com.boos.client.util.combox.ComboBoxTipos;
    import co.com.boos.client.util.iconos.Iconos;
    Those files at least are missing, but without knowing what each of *them* has, it will be hard to say what else is required. Please consider breaking this down into a runnable sample so that someone else can try to confirm the issue.

    I'm moving this into Q&A for now, unless we can get enough information to call it a bug report.

  8. #7
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default


    Thanks

    In a few days I'm going to build a project that you can test.

  9. #8
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default


    I've noticed that when I leave the screen inactive a long time, the thing that I mentioned happens.

  10. #9
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Answers
    107
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Without something I can run, I still can't test, so I'm not sure what it means that waiting a long time makes it change how valid the form is. Just by glancing over the code it looks reasonable, but without running it I can't say for certain. The bug could be hidden in the code you shared, or it could be in another external class you didn't.

  11. #10
    Sencha User
    Join Date
    Mar 2012
    Posts
    36
    Answers
    3
    Vote Rating
    0
    juliandresog is on a distinguished road

      0  

    Default


    For now I can not supply the project.
    Checking a bit I've noticed that sometimes the field when I use getValue(), that returns null although I can see that this has a typed value, and then come back and try without changing the value and works ok.

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar