1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    30
    Vote Rating
    0
    waqas iqbal is on a distinguished road

      0  

    Default Unanswered: Setting focus on missing fields

    Unanswered: Setting focus on missing fields


    hi all,
    i am facing a little trouble i will be happy if u take me out from this

    I have form with many fields in which few are mandotry which can't be left as an empty field, however it shows that these fields are empty but its not scrolling or focusing on missing field.
    I want when user hit submit button it takes it to the place where mandotry field is missing. Kindly provide me suggestions.
    Thanks in Advance
    Waqas Iqbal

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,064
    Answers
    110
    Vote Rating
    92
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    In the submit button handler, you can validate your fields:

    Code:
    if(!field1.validate())
        {
            alert('Must not be empty');
            field1.focus(false, 500);
            return; // return from submit handler
        }
    Check out the documentation for focus(). validate() will work only if you have a validator assigned to the field or e.g. allowBlank is set to false and the field is empty.

  3. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    30
    Vote Rating
    0
    waqas iqbal is on a distinguished road

      0  

    Default


    Thanks for replying......
    My form is quite large and with in this many forms are there in a panel, i want to move cursor to the field which is empty.
    Your case is not working for me any help??

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,064
    Answers
    110
    Vote Rating
    92
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    there are two ways of dealing with this. either you keep your submit button disabled until all necessary fields are filled (non-empty) or when the user presses submit button, you have to validate all the fields. here if you call validate on a field for which allowBlank is set to false and its value is empty, it should return false and then you can use focus() to set focus to that field.

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    30
    Vote Rating
    0
    waqas iqbal is on a distinguished road

      0  

    Default


    Can u provide me with feew examples of it....or tell me what to do else..??

  6. #6
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,064
    Answers
    110
    Vote Rating
    92
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    I already posted an example code for validation and focus in my first reply. Post some of your code for others to see. try to extract a simple example with a form with one field and submit button. you may put your example on jsfiddle.net.

Thread Participants: 1

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